Skip to content

Commit

Permalink
🩹 patch the mandatory arguments to base class object
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenithClown committed Nov 29, 2024
1 parent f6d83d3 commit aab7246
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
9 changes: 6 additions & 3 deletions nlpurify/scoring/baseclass.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# -*- encoding: utf-8 -*-

from typing import Iterable
from typing import List, Iterable
from abc import ABC, abstractmethod

class BaseLogicalOperator(ABC):
def __init__(self):
pass
def __init__(self, string : str, *references : List[str]) -> None:
self.string = string

# list of any n-reference strings for fuzzy scoring
self.references = references


@abstractmethod
Expand Down
6 changes: 1 addition & 5 deletions nlpurify/scoring/fuzzy/logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ def __init__(
*references : List[str],
method : str = "partial_ratio"
) -> None:
super().__init__()
self.string = string

# list of any n-reference strings for fuzzy scoring
self.references = references
super().__init__(string, *references)

# mandatory keyword arguments which determines the fuzzy
# the method is any of the supported argument of the fuzzy
Expand Down
17 changes: 17 additions & 0 deletions nlpurify/scoring/regexp/logical.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- encoding: utf-8 -*-

"""
Creates an Extension to Perform Logical Operations
Logical operations like ``and`` or ``or`` can be implemented with the
module. This reduces manual intervention like using repeated for-loop
and/or conditional statements for the end user.
"""

from typing import List, Iterable

from nlpurify.scoring.baseclass import BaseLogicalOperator

class LogicalRegexp(BaseLogicalOperator):
def __init__(self, string : str, *references : List[str]) -> None:
super().__init__(string, *references)

0 comments on commit aab7246

Please sign in to comment.