Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mideind/Greynir
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Aug 7, 2024
2 parents f3bcc3d + b8cc085 commit b4cfa9d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion article.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def entity_names(self) -> Iterator[str]:
for t in sent:
if t.get("k") == TOK.ENTITY:
# The entity name
yield cast(str, t.get("x", ""))
yield t.get("x", "")

def gen_text(self) -> Iterator[str]:
"""A generator for text from an article token stream"""
Expand Down
12 changes: 8 additions & 4 deletions queries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,9 @@ def init_class(cls) -> None:
if is_proc:
all_procs.append(m)
except ImportError as e:
logging.error(f"Error importing query processor module {modname}: {e}")
logging.error(f"Error importing query processor module {modname}: {repr(e)}")
except Exception as e:
logging.error(f"Error initializing query processor module {modname}: {repr(e)}")

# Sort the processors by descending priority
# so that the higher-priority ones get invoked bfore the lower-priority ones
Expand Down Expand Up @@ -518,7 +520,9 @@ def init_class(cls) -> None:
)
)
except ImportError as e:
logging.error(f"Error importing utility module {modname}: {e}")
logging.error(f"Error importing utility module {modname}: {repr(e)}")
except Exception as e:
logging.error(f"Error initializing utility module {modname}: {repr(e)}")

for processor in cls._tree_processors:
# Check whether this tree processor supplies a query grammar fragment
Expand Down Expand Up @@ -1508,8 +1512,8 @@ def process_query(
return result

except Exception as e:
logging.error(f"Error processing query: {e}")
result = dict(valid=False, error=f"E_EXCEPTION: {e}")
logging.error(f"Error processing query: {repr(e)}")
result = dict(valid=False, error=f"E_EXCEPTION: {repr(e)}")

# If we get here, we failed to answer the query
result["valid"] = False
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from reynir.basics import ConfigError, LineReader

# Do not remove, relied on by other modules who import changedlocale via settings
from reynir.basics import changedlocale
from reynir.basics import changedlocale # type: ignore


class NoIndexWords:
Expand Down

0 comments on commit b4cfa9d

Please sign in to comment.