/// <summary>
        /// e soweli lili
        /// </summary>
        public static ComplexChain SingleEPiChainFactory(HeadedPhrase phrase)
        {
            Chain        piChain = new Chain(Particles.pi, new HeadedPhrase[] { phrase });
            ComplexChain directs = new ComplexChain(Particles.e, new[] { piChain });

            return(directs);
        }
        public static ComplexChain SinglePiEnChainFactory(HeadedPhrase phrase)
        {
            Chain        piChain = new Chain(Particles.pi, new HeadedPhrase[] { phrase });
            ComplexChain c       = new ComplexChain(Particles.en, new Chain[] { piChain });

            return(c);
        }
Exemplo n.º 3
0
 public Exclamation(HeadedPhrase wordSet)
 {
     if (wordSet == null)
     {
         throw new TpSyntaxException("Arg required");
     }
     this.wordSet = wordSet;
 }
        public void SuliAlaParse()
        {
            Dialect      dialect = Dialect.LooseyGoosey;
            ParserUtils  pu      = new ParserUtils(dialect);
            HeadedPhrase hp      = pu.HeadedPhraseParser("suli ala");

            Assert.AreEqual("suli ala", hp.ToString());
        }
        public void PonaKinParse()
        {
            string       testPhrase = "pona kin";
            Dialect      dialect    = Dialect.LooseyGoosey;
            ParserUtils  pu         = new ParserUtils(dialect);
            HeadedPhrase hp         = pu.HeadedPhraseParser(testPhrase);

            Assert.AreEqual(testPhrase, hp.ToString());
        }
        public void MokuAlaMokuParse()
        {
            string       testPhrase = "moku ala moku";
            Dialect      dialect    = Dialect.LooseyGoosey;
            ParserUtils  pu         = new ParserUtils(dialect);
            HeadedPhrase hp         = pu.HeadedPhraseParser(testPhrase);

            Assert.AreEqual(testPhrase, hp.ToString());
        }
        public void CorpusKnowledge_HeadedPhraseParser()
        {
            Dialect     c  = Dialect.LooseyGoosey;
            ParserUtils pu = new ParserUtils(c);

            HeadedPhrase value = pu.HeadedPhraseParser("jan Mato");

            Assert.AreEqual(1, value.Modifiers.Count);
            Assert.AreEqual("jan", value.Head.ToString());
            Assert.AreEqual("Mato", value.Modifiers.First().Text);
        }
Exemplo n.º 8
0
 //The ordinal/cardinal split in TP is fundamentally borked
 public static bool IsNumber(HeadedPhrase phrase)
 {
     if (WordByValue.Instance.Equals(phrase.Head, Words.nanpa))
     {
         //We have an ordinal...
         return(true);
     }
     //# numbers.
     if (BodyNumbers.Contains(phrase.Head.Text) && phrase.Modifiers.All((x => Token.BodyNumbers.Contains(x.Text))))
     {
         return(true);
     }
     if (StupidNumbers.Contains(phrase.Head.Text) && phrase.Modifiers.All(x => Token.StupidNumbers.Contains(x.Text)))
     {
         return(true);
     }
     if (HalfStupidNumbers.Contains(phrase.Head.Text) && phrase.Modifiers.All(x => Token.HalfStupidNumbers.Contains(x.Text)))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
        private static void ProcessingleHeadedPhrase(bool includePos, List <string> gloss, Dialect dialect, HeadedPhrase hp)
        {
            bool shouldSupressJan = WordByValue.Instance.Equals(hp.Head, Words.jan) && hp.Modifiers.Any(x => x.IsProperModifier);

            if (hp.Modifiers != null)
            {
                foreach (Word modifier in hp.Modifiers)
                {
                    gloss.Add(GlossWithFallBack(includePos, dialect, modifier, PartOfSpeech.Adjective));
                }
            }
            if (shouldSupressJan)
            {
                //skip!
            }
            else
            {
                string nounPossiblePlural = GlossWithFallBack(includePos, dialect, hp.Head, PartOfSpeech.Noun);

                if ((!new String[] { "I", "we", "he", "she", "it", "they" }.Contains(nounPossiblePlural)) && hp.IsPlural())
                {
                    nounPossiblePlural = nounPossiblePlural.Pluralize();
                }
                gloss.Add(nounPossiblePlural);
            }
        }
 public HeadedPhraseEquivallenceGenerator(HeadedPhrase phrase)
 {
     this.phrase = phrase;
 }