added noembeddingphrase

This commit is contained in:
stuart committed 2025-12-15 13:57:35 +01:00
1 parent b185261edc
commit 70f0ad121d
3 files changed
+22 -2

No files matched your search

+2 -1
View File
@@ -1,6 +1,6 @@
from .enums import *
from .schemas import *
from .structures import Embedding, Word, Symbol, Phrase,Lexeme
from .structures import Embedding, Word, Symbol, Phrase,Lexeme,NoEmbeddingPhrase
__all__ = [
@@ -11,6 +11,7 @@ __all__ = [
"Symbol",
"Phrase",
"Lexeme",
"NoEmbeddingPhrase",
"EmbedRequest",
"EmbeddingResponse",
"ResponseRequest",
+2 -1
View File
@@ -2,7 +2,7 @@ from .embedding import Embedding
from .lexeme import Lexeme
from .word import Word
from .symbol import Symbol
from .phrase import Phrase
from .phrase import Phrase,NoEmbeddingPhrase
__all__ = [
@@ -11,4 +11,5 @@ __all__ = [
"Word",
"Symbol",
"Phrase",
"NoEmbeddingPhrase",
]
+18
View File
@@ -25,4 +25,22 @@ class Phrase(Lexeme):
id=data["id"],
content=data["content"],
embedding=Embedding.from_dict(data["embedding"]),
)
class NoEmbeddingPhrase(Lexeme):
def __init__(self, id: int, content: str):
self.id = id
self._content = content
@property
def content(self) -> str:
return self._content
@classmethod
def from_dict(cls, data: dict) -> "Phrase":
return cls(
id=data["id"],
content=data["content"]
)