summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/datacite.py
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-01-03 13:46:05 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-01-03 13:46:05 +0100
commit391565cbbc0ba17ffd8c4f5d88d4dfda8a8b323c (patch)
treea6f8c2c5dd3244e2bfc8a6035f5c351770ea9975 /python/fatcat_tools/importers/datacite.py
parent61f0bbfbfdaf41be799fa41c88077806ef913188 (diff)
downloadfatcat-391565cbbc0ba17ffd8c4f5d88d4dfda8a8b323c.tar.gz
fatcat-391565cbbc0ba17ffd8c4f5d88d4dfda8a8b323c.zip
datacite: remove --lang-detect flag
Estimated time for a single call is in the order of 50ms.
Diffstat (limited to 'python/fatcat_tools/importers/datacite.py')
-rw-r--r--python/fatcat_tools/importers/datacite.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py
index bd135569..8034a5c1 100644
--- a/python/fatcat_tools/importers/datacite.py
+++ b/python/fatcat_tools/importers/datacite.py
@@ -196,7 +196,6 @@ class DataciteImporter(EntityImporter):
api,
issn_map_file,
debug=False,
- lang_detect=False,
insert_log_file=None,
**kwargs):
@@ -225,12 +224,9 @@ class DataciteImporter(EntityImporter):
self.read_issn_map_file(issn_map_file)
self.debug = debug
- self.lang_detect = lang_detect
self.insert_log_file = insert_log_file
- print('datacite with debug={}, lang_detect={}'.format(
- self.debug, self.lang_detect),
- file=sys.stderr)
+ print('datacite with debug={}'.format(self.debug), file=sys.stderr)
def lookup_ext_ids(self, doi):
"""
@@ -537,12 +533,11 @@ class DataciteImporter(EntityImporter):
if len(text) > MAX_ABSTRACT_LENGTH:
text = text[:MAX_ABSTRACT_LENGTH] + " [...]"
lang = None
- if self.lang_detect:
- try:
- lang = langdetect.detect(text)
- except langdetect.lang_detect_exception.LangDetectException as err:
- print('[{}] language detection failed: {}'.format(doi, err),
- file=sys.stderr)
+ try:
+ lang = langdetect.detect(text)
+ except langdetect.lang_detect_exception.LangDetectException as err:
+ print('[{}] language detection failed: {}'.format(doi, err),
+ file=sys.stderr)
abstracts.append(
fatcat_openapi_client.ReleaseAbstract(
mimetype="text/plain",