from ieml.grammar import topic, fact, usl root = topic( [ term("i.i.-"), # fabriquer term("a.i.-") ], # vendre [ term("E:S:.o.-"), # vouloir futur term("E:S:.wa.-"), # 1ere personne pluriel term("E:A:T:.") ]) # beaucoup objects = [ { 'usl': usl(root), 'tags': { 'FR': "Nous avons l'intention de fabriquer et de vendre beaucoup", 'EN': "We intend to manufacture and sell a lot" }, 'keywords': { 'FR': [], 'EN': [] } }, { 'usl': usl( fact([ ( root,
from ieml.dictionary import term from ieml.grammar import topic, fact, usl root = topic([term("i.i.-"), # fabriquer term("a.i.-")], # vendre [term("E:S:.o.-"), # vouloir futur term("E:S:.wa.-"), # 1ere personne pluriel term("E:A:T:.")]) # beaucoup objects = [ { 'usl': usl(root), 'tags': { 'FR': "Nous avons l'intention de fabriquer et de vendre beaucoup", 'EN': "We intend to manufacture and sell a lot" }, 'keywords': { 'FR': [], 'EN': [] } }, { 'usl': usl(fact([( root, topic([term("t.i.-s.i.-'u.T:.-U:.-'wo.-',B:.-',_M:.-',_;")]), # véhicule a roue sans conducteur topic([term("E:E:T:.")]) # COD ), ( root, topic([term("S:.-'B:.-'n.-S:.U:.-',")]), # Europe topic([term("E:T:.f.-")]) # dans
def test_replace(self): u = topic([usl('[M:]')]) u2 = replace_paths(u, {'r0': '[S:]'}) self.assertEqual(u2, topic([usl('[S:]')]))
def test_equality(self): ieml = RandomPoolIEMLObjectGenerator(level=Text).text() self.assertEqual(usl(ieml), usl(str(ieml)))
def test_create_topic(self): a = topic([usl('[wa.]'), usl('[we.]')]) b = topic(reversed([usl('[wa.]'), usl('[we.]')])) self.assertEqual(a, b) self.assertEqual(str(a), str(b))
def test_promotion(self): self.assertIsInstance(usl('[A:]'), Word) self.assertIsInstance(topic(['[A:]']), Topic) self.assertIsInstance(term('[A:]'), Term)
def test_word_instanciation(self): with self.assertRaises(CannotParse): # "Too many singular sequences" usl("[([O:M:.]+[wa.]+[M:M:.])*([O:O:.M:O:.-])]")