aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpython/grobid2json.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/python/grobid2json.py b/python/grobid2json.py
index 1f7270c..75fdcba 100755
--- a/python/grobid2json.py
+++ b/python/grobid2json.py
@@ -146,7 +146,8 @@ def teixml2json(content, encumbered=True):
text = tei.find('.//{%s}text' % (ns))
#print(text.attrib)
- info['language_code'] = text.attrib['{%s}lang' % xml_ns] # xml:lang
+ if text.attrib.get('{%s}lang' % xml_ns):
+ info['language_code'] = text.attrib['{%s}lang' % xml_ns] # xml:lang
if encumbered:
el = tei.find('.//{%s}profileDesc/{%s}abstract' % (ns, ns))