added noembeddingphrase
This commit is contained in:
1 parent
b185261edc
commit
70f0ad121d
3 files changed
+22
-2
No files matched your search
@@ -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,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",
|
||||
]
|
||||
@@ -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"]
|
||||
)
|
||||
Reference in new issue
Block a user