summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Korostil <ted.korostiled@gmail.com>2012-06-20 15:07:21 +0300
committerDaniel Korostil <ted.korostiled@gmail.com>2012-06-20 15:07:21 +0300
commit1b3ba6ba926cdbdff06ca9267333f2294971961e (patch)
treef6495d235c1a801e31c3046eb9d661c180b6250d /src
parent3a39334b35dd36597c0fefafc11ea60d4340a955 (diff)
unistall dublicate
Diffstat (limited to 'src')
-rw-r--r--src/convertor/xml2reexp.py15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/convertor/xml2reexp.py b/src/convertor/xml2reexp.py
deleted file mode 100644
index fc235c3..0000000
--- a/src/convertor/xml2reexp.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import xml.etree.ElementTree as ET
-
-tree = ET.parse("grammar.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"):
- print "(%s)" % token.text,
- print "->", rule.find('message').find('suggestion').text, "# Did you mean?"
-