HasSemanticModel()
Upgrades text similarity from lexical bag-of-words to true MEANING via a runtime neural model (load one process-wide with StzNeuralModelQ(path)). With no model loaded these degrade gracefully to the lexical path, so code keeps working and auto-improves once a model is present. TRUE if a runtime embedding model is loaded and ready.
aussi écrite: IsSemanticModelReady
Exemples de base (1)
o = new stzText("The cat sits on the mat")
# no model loaded here
? o.HasSemanticModel()
# Embedding() is empty without a model
? len(o.Embedding())
# SemanticSimilarityWith falls back to a lexical score in [-1,1]
? o.SemanticSimilarityWith("A kitten rests on the rug") >= 0
# identical text is maximally similar (lexical)
? o.SemanticSimilarityWith("The cat sits on the mat") > 0.99
# a non-string comparand is rejected
? o.SemanticSimilarityWith(123)
# IsSemanticallySimilarTo respects the threshold
? o.IsSemanticallySimilarTo("The cat sits on the mat", 0.5)0 0 1 1 0 1
exécuté le 2026-10-02 04:23 dans la bibliothèque au commit 0e72e2e2c ; tiré de text_query_layer_narrated.ring(s'ouvre dans un nouvel onglet)
Les extensions de cette méthode
Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).
Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.
Voir aussi
- La classe stzText
- La référence du domaine : Traitement du langage et linguistique
- Les autres méthodes de ces exemples : stzText.Embedding · stzText.IsSemanticallySimilarTo · stzText.SemanticSimilarityWith

