Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescalam committed Jan 12, 2024
1 parent 7679e26 commit c651b4a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
12 changes: 7 additions & 5 deletions semantic_router/encoders/tfidf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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
from collections import Counter
from typing import Dict

import numpy as np
from numpy import ndarray
from numpy.linalg import norm

from semantic_router.encoders import BaseEncoder
from semantic_router.route import Route


class TfidfEncoder(BaseEncoder):
Expand Down
4 changes: 2 additions & 2 deletions semantic_router/hybrid_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def __init__(
):
self.encoder = encoder
self.score_threshold = self.encoder.score_threshold

if sparse_encoder is None:
logger.warning("No sparse_encoder provided. Using default BM25Encoder.")
self.sparse_encoder = BM25Encoder()
else:
self.sparse_encoder = sparse_encoder

self.alpha = alpha
self.routes = routes
if isinstance(self.sparse_encoder, TfidfEncoder) and hasattr(
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/encoders/test_tfidf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np
import pytest

from semantic_router.encoders import TfidfEncoder
from semantic_router.route import Route
import numpy as np


@pytest.fixture
Expand Down

0 comments on commit c651b4a

Please sign in to comment.