66a06524eba0b22d14204baeb2ca6d4c9db7d1d0,scripts/semantic_types.py,,convert_coq_to_nltk_type,#Any#,245

Before Change


    assert parameter == "Parameter" and colon == ":"
    // This list contains something like ["Entity", "->", "Prop", "->", "Prop"...]
    type_sig = coq_type_list[3:]
    type_ids = []
    for i, type_item in enumerate(type_sig):
        assert (i % 2 == 1) == (type_item == "->")
        if type_item.startswith("Entity"):
            type_ids.append("e")
        elif type_item.startswith("Prop"):
            type_ids.append("t")
        elif type_item.startswith("Event"):
            type_ids.append("v")
        elif type_item != "->":
            raise(ValueError("Invalid type name: %s in %s" % (type_item, coq_type)))
    assert len(type_ids) > 0
    if len(type_ids) == 1:

After Change


    if not nltk_type_str.startswith("(") or not nltk_type_str.endswith("("):
        nltk_type_str = "(" + nltk_type_str + ")"
    // Add pre-terminals (necessary for NLTK, if we convert to CNF).
    nltk_type_str = re.sub(r"([evt])", r"(N \1)", nltk_type_str)
    nltk_type_tree = tree_or_string(nltk_type_str)
    nltk_type_tree.chomsky_normal_form(factor="right")
    nltk_type_str = remove_labels_and_unaries(nltk_type_tree).replace(
        "( ", "(").replace(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: mynlp/ccg2lambda
Commit Name: 66a06524eba0b22d14204baeb2ca6d4c9db7d1d0
Time: 2017-05-12
Author: pascual@nii.ac.jp
File Name: scripts/semantic_types.py
Class Name:
Method Name: convert_coq_to_nltk_type


Project Name: ijmarshall/robotreviewer
Commit Name: dfc58ff63a64e9a3b83afaeded706192505f08fa
Time: 2016-08-17
Author: byron.wallace@gmail.com
File Name: robotreviewer/textprocessing/pdfreader.py
Class Name: PdfReader
Method Name: parse_xml


Project Name: ijmarshall/robotreviewer
Commit Name: 6a7db8d13e7d24a209a0bb22a3ebde24057b0adb
Time: 2016-08-17
Author: byron.wallace@gmail.com
File Name: robotreviewer/textprocessing/pdfreader.py
Class Name: PdfReader
Method Name: parse_xml


Project Name: nltk/nltk
Commit Name: 5e233859c5fef3c6c5059fe0f8e201b9f67b4e67
Time: 2019-05-07
Author: alvations@gmail.com
File Name: nltk/corpus/reader/wordnet.py
Class Name: WordNetCorpusReader
Method Name: _synset_from_pos_and_line