-
Notifications
You must be signed in to change notification settings - Fork 4
merge: resolve conflicts — bring main into copilot/repair-broken-knowledge-endpoints (unblock PR #115) #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5eb5da3
20ad9f9
3ae6b1c
e1e1887
310a5f3
58ec90e
71acb6c
d1c45eb
f5bcbc6
7592a2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,8 +14,16 @@ | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| from typing import Dict, List, Optional, Tuple, Any, Set | ||||||||||||||||||||||||
| from dataclasses import dataclass, field | ||||||||||||||||||||||||
| import spacy | ||||||||||||||||||||||||
| from spacy.tokens import Doc, Token as SpacyToken | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| import spacy | ||||||||||||||||||||||||
| from spacy.tokens import Doc, Token as SpacyToken | ||||||||||||||||||||||||
| _SPACY_AVAILABLE = True | ||||||||||||||||||||||||
| except ImportError: | ||||||||||||||||||||||||
| spacy = None # type: ignore[assignment] | ||||||||||||||||||||||||
| Doc = None # type: ignore[assignment,misc] | ||||||||||||||||||||||||
| SpacyToken = None # type: ignore[assignment,misc] | ||||||||||||||||||||||||
| _SPACY_AVAILABLE = False | ||||||||||||||||||||||||
|
Comment on lines
+22
to
+26
|
||||||||||||||||||||||||
| except ImportError: | |
| spacy = None # type: ignore[assignment] | |
| Doc = None # type: ignore[assignment,misc] | |
| SpacyToken = None # type: ignore[assignment,misc] | |
| _SPACY_AVAILABLE = False | |
| except ImportError as exc: | |
| raise ImportError( | |
| "The 'godelOS.nlu_nlg.nlu.lexical_analyzer_parser' module requires spaCy " | |
| "to be installed. Please install spaCy (e.g. 'pip install spacy' and the " | |
| "appropriate language model) before using the lexical analyzer and parser." | |
| ) from exc |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,9 +14,15 @@ | |||||||||
| from godelOS.core_kr.ast.nodes import AST_Node | ||||||||||
| from godelOS.core_kr.type_system.manager import TypeSystemManager | ||||||||||
|
|
||||||||||
| from godelOS.nlu_nlg.nlu.lexical_analyzer_parser import ( | ||||||||||
| LexicalAnalyzerParser, SyntacticParseOutput | ||||||||||
| ) | ||||||||||
| try: | ||||||||||
| from godelOS.nlu_nlg.nlu.lexical_analyzer_parser import ( | ||||||||||
| LexicalAnalyzerParser, SyntacticParseOutput | ||||||||||
| ) | ||||||||||
| _LAP_AVAILABLE = True | ||||||||||
| except (ImportError, Exception): | ||||||||||
| LexicalAnalyzerParser = None # type: ignore[assignment,misc] | ||||||||||
| SyntacticParseOutput = None # type: ignore[assignment,misc] | ||||||||||
|
Comment on lines
+23
to
+24
|
||||||||||
| LexicalAnalyzerParser = None # type: ignore[assignment,misc] | |
| SyntacticParseOutput = None # type: ignore[assignment,misc] | |
| LexicalAnalyzerParser = Any # type: ignore[assignment,misc] | |
| SyntacticParseOutput = Any # type: ignore[assignment,misc] |
Copilot
AI
Mar 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_LAP_AVAILABLE is based on whether the module imports, but lexical_analyzer_parser.py now swallows spaCy ImportError, so this will still be True even when spaCy is missing. That means the pipeline will try to instantiate LexicalAnalyzerParser() and fail later with an AttributeError rather than cleanly entering the intended degraded mode. Consider checking an explicit availability flag from the LAP module (e.g., _SPACY_AVAILABLE) and/or guarding inside LexicalAnalyzerParser.__init__ with a clear error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MI approximation uses
_binned_entropy()which callsnp.histogram(values, bins=num_bins)without a sharedrange/bin edges. Sincenp.histogramchooses bin edges based on each input array’s min/max,H(A),H(B), andH(A∪B)are computed over different discretizations, makingH(A)+H(B)-H(A∪B)mathematically inconsistent and potentially distorting φ across partitions. Use common bin edges derived fromvec_all(or a fixed global range) when computing entropies forvec_a,vec_b, andvec_all.