How to use the conllu.parser.parse_dict_value function in conllu

To help you get started, we’ve selected a few conllu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EmilStenstrom / conllu / tests / test_parser.py View on Github external
def test_parse_dict_value(self):
        self.assertEqual(
            parse_dict_value("key1"),
            Token([("key1", "")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1"),
            Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
Token([("key1", "")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1"),
            Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
def test_parse_dict_value(self):
        self.assertEqual(
            parse_dict_value("key1"),
            Token([("key1", "")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1"),
            Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)
github EmilStenstrom / conllu / tests / test_integration.py View on Github external
                "pfeats": lambda line, i: parse_dict_value(line[i]),
                "phead": lambda line, i: parse_int_value(line[i]),
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
def test_parse_dict_value(self):
        self.assertEqual(
            parse_dict_value("key1"),
            Token([("key1", "")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1"),
            Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
def test_parse_dict_value(self):
        self.assertEqual(
            parse_dict_value("key1"),
            Token([("key1", "")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1"),
            Token([("key1", "val1")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
github EmilStenstrom / conllu / tests / test_parser.py View on Github external
parse_dict_value("key1=val1|key2=val2"),
            Token([("key1", "val1"), ("key2", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key2|key3=val3"),
            Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
        )
        self.assertEqual(
            parse_dict_value("key1=val1|key1=val2"),
            Token([("key1", "val2")])
        )
        self.assertEqual(
            parse_dict_value("key1=_|_|_=val1"),
            Token([("key1", None)])
        )
        self.assertEqual(parse_dict_value(""), None)
        self.assertEqual(parse_dict_value("_"), None)