e3d04b13aed7abcfab08449618aacece0e6e22a0,scripts/convert_formulas.py,,get_formulas_from_xml,#Any#,19

Before Change


DOCS=None

def get_formulas_from_xml(doc):
    formulas = [s.get("sem", None) for s in doc.xpath(
        "./sentences/sentence/semantics[1]/span[1]")]
    formulas = [f for f in formulas if f is not None]
    return formulas

After Change



def get_formulas_from_xml(doc):
    formulas = []
    for f in doc.xpath("./sentences/sentence"):
        if f.xpath("semantics"):
            s = f.xpath("semantics")[0]
            if s.get("status") == "success":
                formulas += s.xpath("span[1]/@sem")
            else:
                formulas.append("semantics_error")
        else:
            formulas.append("syntax_error")
    return formulas

def main(args = None):
    global ARGS
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: mynlp/ccg2lambda
Commit Name: e3d04b13aed7abcfab08449618aacece0e6e22a0
Time: 2019-04-21
Author: mineshima.koji@ocha.ac.jp
File Name: scripts/convert_formulas.py
Class Name:
Method Name: get_formulas_from_xml


Project Name: mynlp/ccg2lambda
Commit Name: 78b1ea1c7df34fa33c04e9a988d8a77b86cb4168
Time: 2017-10-05
Author: pasmargo@gmail.com
File Name: scripts/visualization_tools.py
Class Name:
Method Name: convert_doc_to_mathml


Project Name: mynlp/ccg2lambda
Commit Name: e1efd3c7338564009712a8385db123b929be178d
Time: 2017-05-30
Author: pascual@nii.ac.jp
File Name: scripts/ccg2lambda_tools.py
Class Name:
Method Name: assign_semantics_to_ccg