Example #1
0
        public void ToString_MultipleWords_ReturnsWhiteSpaceSeparatedWords()
        {
            string line             = " 2301 a\tja\tsom\tsa";
            string expectedToString = "a ja som sa";
            Ngram  ngram            = new Ngram(line);

            var result = ngram.ToString();

            Assert.AreEqual(result, expectedToString);
        }
Example #2
0
        public override string ToString()
        {
            switch (_type)
            {
            case AffixType.Prefix:
                return(_ngram + "-");

            case AffixType.Suffix:
                return("-" + _ngram);
            }
            return(_ngram.ToString());
        }
Example #3
0
        public override bool Matches(ShapeNode leftNode, Ngram<Segment> target, ShapeNode rightNode)
        {
            string strRep = target.ToString();
            if (_ignoreModifiers)
                strRep = StripModifiers(strRep);

            if (leftNode != null && leftNode.Type() == CogFeatureSystem.AnchorType && _normalizedSegments.Contains(string.Format("#{0}", strRep)))
                return true;

            if (rightNode != null && rightNode.Type() == CogFeatureSystem.AnchorType && _normalizedSegments.Contains(string.Format("{0}#", strRep)))
                return true;

            return _normalizedSegments.Contains(strRep);
        }
Example #4
0
        public override string ToString()
        {
            string targetStr = _target.ToString();

            if (_leftEnv != null && _rightEnv != null)
            {
                return(string.Format("{0} -> ? / [{1}] _ [{2}]", targetStr, _leftEnv.Name, _rightEnv.Name));
            }
            if (_leftEnv != null && _rightEnv == null)
            {
                return(string.Format("{0} -> ? / [{1}] _", targetStr, _leftEnv.Name));
            }
            if (_leftEnv == null && _rightEnv != null)
            {
                return(string.Format("{0} -> ? / _ [{1}]", targetStr, _rightEnv.Name));
            }
            return(string.Format("{0} -> ?", targetStr));
        }
Example #5
0
        public override bool Matches(ShapeNode leftNode, Ngram <Segment> target, ShapeNode rightNode)
        {
            string strRep = target.ToString();

            if (_ignoreModifiers)
            {
                strRep = StripModifiers(strRep);
            }

            if (leftNode != null && leftNode.Type() == CogFeatureSystem.AnchorType && _normalizedSegments.Contains(string.Format("#{0}", strRep)))
            {
                return(true);
            }

            if (rightNode != null && rightNode.Type() == CogFeatureSystem.AnchorType && _normalizedSegments.Contains(string.Format("{0}#", strRep)))
            {
                return(true);
            }

            return(_normalizedSegments.Contains(strRep));
        }
Example #6
0
 public override string ToString()
 {
     return(_ngram.ToString());
 }