Skip to content

Commit

Permalink
Removed all libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-lperezra committed Dec 21, 2024
1 parent 1b3aa19 commit 236c120
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
4 changes: 0 additions & 4 deletions iris/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ RUN chmod +x /webapp.xml

RUN pip3 install -r /requirements.txt --break-system-packages

RUN spacy download es_dep_news_trf --break-system-packages

RUN spacy download en_core_web_md --break-system-packages

USER irisowner

# copy files to image
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sentence-transformers
numpy
pandas
spacy
pandas
3 changes: 1 addition & 2 deletions src/ENCODER/BP/AnalyzeTextProcess.cls
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ Method AnalyzeText(text As %String, analysisId As %String, language As %String)
model = sentence_transformers.SentenceTransformer('/iris-shared/model/')
phrases = analyzedText['response'].replace('"',"").split(",")
sqlsentence = ""
iris.cls("Ens.Util.Log").LogInfo("ENCODER.BP.AnalyzeTextProcess", "AnalyzeText", "Starting process")
# iris.cls("Ens.Util.Log").LogInfo("ENCODER.BP.AnalyzeTextProcess", "AnalyzeText", "Starting process")
for phraseToAnalyze in phrases :
if phraseToAnalyze != "":
embedding = model.encode(phraseToAnalyze, normalize_embeddings=True).tolist()
sqlsentence = "INSERT INTO ENCODER_Object.TextMatches (CodeId, Description, Similarity, AnalysisId, RawText) SELECT TOP 50 * FROM (SELECT CodeId, Description, VECTOR_DOT_PRODUCT(VectorDescription, TO_VECTOR('"+str(embedding)+"', DECIMAL)) AS Similarity, '"+analysisId+"', '"+phraseToAnalyze+"' FROM ENCODER_Object.Codes) ORDER BY Similarity DESC"
iris.cls("ENCODER.Utils.Manager").ExecuteInsertQuery(sqlsentence)
iris.cls("Ens.Util.Log").LogInfo("ENCODER.BP.AnalyzeTextProcess", "AnalyzeText", sqlsentence)
except Exception as err:
iris.cls("Ens.Util.Log").LogInfo("ENCODER.BP.AnalyzeTextProcess", "AnalyzeText", repr(err))
return repr(err)
Expand Down
13 changes: 0 additions & 13 deletions src/ENCODER/Utils/Manager.cls
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,4 @@ ClassMethod DownloadModel() As %String [ Language = python ]
return "Downloaded"
}

ClassMethod LematizeText(textToLematize As %String) As %String [ Language = python ]
{
import spacy

nlp = spacy.load('es_dep_news_trf')

doc = nlp(textToLematize)
words = [t.orth_ for t in doc if not t.is_punct | t.is_stop]
lexical_tokens = [t.lower() for t in words if t.isalpha()]

return " ".join(lexical_tokens)
}

}

0 comments on commit 236c120

Please sign in to comment.