fix phrase with new lexeme verion
This commit is contained in:
1 parent
f91c4f6b20
commit
7cc7d05fc6
1 file changed
+1
-38
@@ -7,49 +7,12 @@ import numpy as np
|
||||
|
||||
|
||||
class NoEmbeddingPhrase(Lexeme):
|
||||
def __init__(self, id: int, content: str):
|
||||
self.id = id
|
||||
self._content = content
|
||||
self._original_content = content
|
||||
self._embedding = np.array([]) # Placeholder to avoid attribute errors
|
||||
|
||||
@property
|
||||
def content(self) -> str:
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def original_content(self) -> str:
|
||||
#temporarily return content as original_content
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def embedding(self) -> Embedding:
|
||||
return self._embedding
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "NoEmbeddingPhrase":
|
||||
return cls(id=data["id"], content=data["content"])
|
||||
return cls(id=data["id"], content=data["content"],embedding=None)
|
||||
|
||||
|
||||
class Phrase(Lexeme):
|
||||
def __init__(self, id: int, content: str, embedding: Embedding):
|
||||
self.id = id
|
||||
self._content = content
|
||||
self._original_content = content
|
||||
self._embedding = embedding
|
||||
|
||||
@property
|
||||
def content(self) -> str:
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def original_content(self) -> str:
|
||||
#temporarily return content as original_content
|
||||
return self._content
|
||||
|
||||
@property
|
||||
def embedding(self) -> Embedding:
|
||||
return self._embedding
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "Phrase":
|
||||
|
||||
Reference in new issue
Block a user