added original_content better
This commit is contained in:
1 parent
b05b30e450
commit
947d775e4e
2 files changed
+13
No files matched your search
@@ -13,6 +13,12 @@ class Lexeme(ABC):
|
||||
def content(self) -> Union[str, List[str]]:
|
||||
"""Text content of the lexeme."""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def original_content(self) -> Union[str, List[str]]:
|
||||
"""Original text content of the lexeme."""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
@@ -43,6 +49,7 @@ class Lexeme(ABC):
|
||||
lambda x: {
|
||||
"id": x.id,
|
||||
"content": x.content,
|
||||
"original_content": x.original_content,
|
||||
"embedding": {"data": x.embedding.data.tolist()},
|
||||
},
|
||||
when_used="json",
|
||||
@@ -53,6 +60,7 @@ class Lexeme(ABC):
|
||||
json_schema=core_schema.typed_dict_schema(
|
||||
{
|
||||
"id": core_schema.typed_dict_field(core_schema.int_schema()),
|
||||
"original_content": core_schema.typed_dict_field(core_schema.str_schema()),
|
||||
"content": core_schema.typed_dict_field(core_schema.str_schema()),
|
||||
"embedding": core_schema.typed_dict_field(
|
||||
handler.generate_schema(Embedding)
|
||||
|
||||
@@ -15,6 +15,11 @@ class NoEmbeddingPhrase(Lexeme):
|
||||
@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:
|
||||
|
||||
Reference in new issue
Block a user