diff options
author | Daniel Korostil <ted.korostiled@gmail.com> | 2012-06-22 05:46:03 +0300 |
---|---|---|
committer | Daniel Korostil <ted.korostiled@gmail.com> | 2012-06-22 05:46:03 +0300 |
commit | e838b8497c9c6c8634a7d8a5f642a9098622f502 (patch) | |
tree | f6495d235c1a801e31c3046eb9d661c180b6250d | |
parent | 7dc45cddcf22d28ada6ba46b717298e37fb00826 (diff) |
removed old files and updated converter to parse upcoming marker tag
-rw-r--r-- | src/converter/test.py | 26 | ||||
-rw-r--r-- | src/converter/test.xml | 14 |
2 files changed, 0 insertions, 40 deletions
diff --git a/src/converter/test.py b/src/converter/test.py deleted file mode 100644 index 051987e..0000000 --- a/src/converter/test.py +++ /dev/null @@ -1,26 +0,0 @@ -import xml.etree.ElementTree as ET -import string - - -tree = ET.parse("test.xml") # parsing grammar.xml into an ElementTree instance - -# list all rules with simple tokens -for rule in tree.iter("rule"): # cycle for all <rule> elements of grammar.xml, variable rule contains the data of the actual element - simple = True # simple rule is a rule with tokens without attributes (see documentaton of LanguageTool grammar.xml) - for token in rule.iter("token"): # cycle for all tokens in the actual rule, variable token contains the data of the actual <token> element - if token.attrib and token.attrib.keys() != ["regexp"]: # if attrib is not an empty dict (attrib is the Python dict of attributes of the XML element, see ElementTree doc), regexp is supported by the parethesized tokens in the output - simple = False # the rule is not simple - if simple: - for token in rule.iter("token"): - if pattern.attrib == None: - print "(%s)" % token.text, - if pattern.attrib != None: - MarkFrom = pattern.attrib['mark_from'].text - 1 - MarkTo = pattern.attrib['mark_to'].text + 1 - MarkText = token.text - Mark = string.split(MarkText) - for list in Mark: - list[MarkFrom:MarkTo] = "(" + Mark[MarkFrom:MarkTo] + ")" - print "(%s)" % Mark, - print "->", rule.find('message').find('suggestion').text, "# Did you mean?" - diff --git a/src/converter/test.xml b/src/converter/test.xml deleted file mode 100644 index 61d4e58..0000000 --- a/src/converter/test.xml +++ /dev/null @@ -1,14 +0,0 @@ -<rule> - <pattern mark_from="2" mark_to="-2"> - <token postag="SENT_START"></token> - <token>To</token> - <token>being</token> - <token>with</token> - <token>,</token> - </pattern> - <message>Did you mean <suggestion>begin</suggestion>?</message> - <short>Possible typo</short> - <example correction="begin" type="incorrect">To -<marker>being</marker> with, she is a Russian spy.</example> - <example type="correct">To begin with, she's a spy.</example> - </rule>
\ No newline at end of file |