示例#1
0
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,
示例#2
0
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
示例#3
0
 def test_replace(self):
     u = topic([usl('[M:]')])
     u2 = replace_paths(u, {'r0': '[S:]'})
     self.assertEqual(u2, topic([usl('[S:]')]))
示例#4
0
 def test_equality(self):
     ieml = RandomPoolIEMLObjectGenerator(level=Text).text()
     self.assertEqual(usl(ieml), usl(str(ieml)))
示例#5
0
 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))
示例#6
0
    def test_promotion(self):
        self.assertIsInstance(usl('[A:]'), Word)
        self.assertIsInstance(topic(['[A:]']), Topic)

        self.assertIsInstance(term('[A:]'), Term)
示例#7
0
 def test_word_instanciation(self):
     with self.assertRaises(CannotParse):
         # "Too many singular sequences"
         usl("[([O:M:.]+[wa.]+[M:M:.])*([O:O:.M:O:.-])]")