From 70f0ad121d9041a31fd5ab2edd9377eb61819097 Mon Sep 17 00:00:00 2001 From: stuartgo Date: Mon, 15 Dec 2025 13:57:35 +0100 Subject: [PATCH] added noembeddingphrase --- anansyTypes/__init__.py | 3 ++- anansyTypes/structures/__init__.py | 3 ++- anansyTypes/structures/phrase.py | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/anansyTypes/__init__.py b/anansyTypes/__init__.py index 7d245de..e52d7e0 100644 --- a/anansyTypes/__init__.py +++ b/anansyTypes/__init__.py @@ -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", diff --git a/anansyTypes/structures/__init__.py b/anansyTypes/structures/__init__.py index 7ac324a..22bf775 100644 --- a/anansyTypes/structures/__init__.py +++ b/anansyTypes/structures/__init__.py @@ -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", ] diff --git a/anansyTypes/structures/phrase.py b/anansyTypes/structures/phrase.py index 92d56ed..7321512 100644 --- a/anansyTypes/structures/phrase.py +++ b/anansyTypes/structures/phrase.py @@ -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"] ) \ No newline at end of file