mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 23:11:00 +02:00
Compare commits
2 commits
fd8d5b2c42
...
dd974b0cac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd974b0cac | ||
|
|
d08ec56a73 |
2 changed files with 11 additions and 9 deletions
|
|
@ -29,8 +29,8 @@ class Field:
|
|||
|
||||
parts = defn.split(":")
|
||||
|
||||
if len(parts) == 0:
|
||||
raise RuntimeError("Field definition cannot be empty")
|
||||
if len(parts) > 5:
|
||||
raise RuntimeError("Too many fields in definition")
|
||||
|
||||
if len(parts) == 1: parts.append("string")
|
||||
if len(parts) == 2: parts.append("0")
|
||||
|
|
@ -43,7 +43,7 @@ class Field:
|
|||
|
||||
try:
|
||||
type = FieldType[type.upper()]
|
||||
except:
|
||||
except KeyError:
|
||||
raise RuntimeError(f"Field type {type} is not known")
|
||||
|
||||
pri = True if pri == "pri" else False
|
||||
|
|
|
|||
|
|
@ -18,24 +18,26 @@ try:
|
|||
except LookupError:
|
||||
try:
|
||||
nltk.download('punkt_tab', quiet=True)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to download punkt_tab: {e}. Attempting fallback to punkt.")
|
||||
# Fallback to older punkt if punkt_tab not available
|
||||
try:
|
||||
nltk.download('punkt', quiet=True)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to download fallback punkt: {e}. NLTK data is missing.")
|
||||
|
||||
try:
|
||||
nltk.data.find('taggers/averaged_perceptron_tagger_eng')
|
||||
except LookupError:
|
||||
try:
|
||||
nltk.download('averaged_perceptron_tagger_eng', quiet=True)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to download averaged_perceptron_tagger_eng: {e}. Attempting fallback.")
|
||||
# Fallback to older name
|
||||
try:
|
||||
nltk.download('averaged_perceptron_tagger', quiet=True)
|
||||
except:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to download fallback averaged_perceptron_tagger: {e}. NLTK data is missing.")
|
||||
|
||||
try:
|
||||
nltk.data.find('corpora/stopwords')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue