Skip to content
Snippets Groups Projects
Select Git revision
  • 9444b075982099ad71026d10d9251b0a384569df
  • master default protected
  • vertical_relations
  • lu_without_semantic_frames
  • hierarchy
  • additional-unification-filters
  • v0.1.1
  • v0.1.0
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
  • v0.0.1
17 results

models.py

Blame
  • isinside.h 1.44 KiB
    #ifndef LIBWCCL_OPS_FUNCTIONS_BOOL_PREDICATES_ISINSIDE_H
    #define LIBWCCL_OPS_FUNCTIONS_BOOL_PREDICATES_ISINSIDE_H
    
    #include <libwccl/ops/functions/bool/predicate.h>
    #include <libwccl/values/position.h>
    
    namespace Wccl {
    
    /**
     * Predicate that checks if a position is within sentence boundaries
     */
    class IsInside : public Predicate
    {
    public:
    	typedef boost::shared_ptr<Function<Position> > PosFunctionPtr;
    
    	IsInside(const PosFunctionPtr& pos_expr)
    		: pos_expr_(pos_expr)
    	{
    		BOOST_ASSERT(pos_expr_);
    	}
    
    	/**
    	 * @returns String representation of the function in the form of:
    	 * "inside(arg_expr_string)"
    	 */
    	std::string to_string(const Corpus2::Tagset& tagset) const;
    
    	/**
    	 * @returns Name of the function: "inside"
    	 */
    	std::string raw_name() const {
    		return "inside";
    	}
    
    protected:
    	const PosFunctionPtr pos_expr_;
    
    	/**
    	 * Takes values of position from argument, and checks if it is inside sentence
    	 * boundaries.
    	 * @returns True value if position is within sentence boundaries, False otherwise.
    	 */
    	BaseRetValPtr apply_internal(const FunExecContext& context) const;
    
    	/**
    	 * Writes raw string representation of the function in the form of:
    	 * "inside(arg_expr_raw_string)"
    	 * @note This version doesn't require a tagset, but may be incomplete
    	 * and/or contain internal info.
    	 * @returns Stream written to.
    	 */
    	std::ostream& write_to(std::ostream& os) const;
    };
    
    } /* end ns Wccl */
    
    #endif // LIBWCCL_OPS_FUNCTIONS_BOOL_PREDICATES_ISINSIDE_H