Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
c651b4af
Unverified
Commit
c651b4af
authored
1 year ago
by
James Briggs
Browse files
Options
Downloads
Patches
Plain Diff
lint
parent
7679e261
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
semantic_router/encoders/tfidf.py
+7
-5
7 additions, 5 deletions
semantic_router/encoders/tfidf.py
semantic_router/hybrid_layer.py
+2
-2
2 additions, 2 deletions
semantic_router/hybrid_layer.py
tests/unit/encoders/test_tfidf.py
+2
-1
2 additions, 1 deletion
tests/unit/encoders/test_tfidf.py
with
11 additions
and
8 deletions
semantic_router/encoders/tfidf.py
+
7
−
5
View file @
c651b4af
import
numpy
as
np
from
collections
import
Counter
from
semantic_router.encoders
import
BaseEncoder
from
semantic_router.route
import
Route
from
numpy.linalg
import
norm
import
string
import
string
from
collections
import
Counter
from
typing
import
Dict
from
typing
import
Dict
import
numpy
as
np
from
numpy
import
ndarray
from
numpy
import
ndarray
from
numpy.linalg
import
norm
from
semantic_router.encoders
import
BaseEncoder
from
semantic_router.route
import
Route
class
TfidfEncoder
(
BaseEncoder
):
class
TfidfEncoder
(
BaseEncoder
):
...
...
This diff is collapsed.
Click to expand it.
semantic_router/hybrid_layer.py
+
2
−
2
View file @
c651b4af
...
@@ -27,13 +27,13 @@ class HybridRouteLayer:
...
@@ -27,13 +27,13 @@ class HybridRouteLayer:
):
):
self
.
encoder
=
encoder
self
.
encoder
=
encoder
self
.
score_threshold
=
self
.
encoder
.
score_threshold
self
.
score_threshold
=
self
.
encoder
.
score_threshold
if
sparse_encoder
is
None
:
if
sparse_encoder
is
None
:
logger
.
warning
(
"
No sparse_encoder provided. Using default BM25Encoder.
"
)
logger
.
warning
(
"
No sparse_encoder provided. Using default BM25Encoder.
"
)
self
.
sparse_encoder
=
BM25Encoder
()
self
.
sparse_encoder
=
BM25Encoder
()
else
:
else
:
self
.
sparse_encoder
=
sparse_encoder
self
.
sparse_encoder
=
sparse_encoder
self
.
alpha
=
alpha
self
.
alpha
=
alpha
self
.
routes
=
routes
self
.
routes
=
routes
if
isinstance
(
self
.
sparse_encoder
,
TfidfEncoder
)
and
hasattr
(
if
isinstance
(
self
.
sparse_encoder
,
TfidfEncoder
)
and
hasattr
(
...
...
This diff is collapsed.
Click to expand it.
tests/unit/encoders/test_tfidf.py
+
2
−
1
View file @
c651b4af
import
numpy
as
np
import
pytest
import
pytest
from
semantic_router.encoders
import
TfidfEncoder
from
semantic_router.encoders
import
TfidfEncoder
from
semantic_router.route
import
Route
from
semantic_router.route
import
Route
import
numpy
as
np
@pytest.fixture
@pytest.fixture
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment