-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refactor/modules' of github.com:mindsdb/type_infer into…
… refactor/modules
- Loading branch information
Showing
17 changed files
with
569 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
4 changes: 3 additions & 1 deletion
4
tests/unit_tests/test_dates.py → tests/unit_tests/rule_based/test_dates.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import unittest | ||
import random | ||
|
||
import pandas as pd | ||
from type_infer.rule_based.core import RuleBasedEngine | ||
from type_infer.dtype import dtype | ||
|
||
get_column_data_type = RuleBasedEngine.get_column_data_type | ||
|
||
|
||
class TestInferDtypes(unittest.TestCase): | ||
def test_negative_integers(self): | ||
data = pd.DataFrame([-random.randint(-10, 10) for _ in range(100)], columns=['test_col']) | ||
engine = RuleBasedEngine() | ||
dtyp, dist, ainfo, warn, info = engine.get_column_data_type(data['test_col'], data, 'test_col', 0.0) | ||
self.assertEqual(dtyp, dtype.integer) | ||
|
||
def test_negative_floats(self): | ||
data = pd.DataFrame([float(-random.randint(-10, 10)) for _ in range(100)] + [0.1], columns=['test_col']) | ||
engine = RuleBasedEngine() | ||
dtyp, dist, ainfo, warn, info = engine.get_column_data_type(data['test_col'], data, 'test_col', 0.0) | ||
self.assertEqual(dtyp, dtype.float) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import unittest | ||
|
||
from type_infer.rule_based.helpers import tokenize_text | ||
|
||
|
||
class TestDates(unittest.TestCase): | ||
def test_get_tokens(self): | ||
sentences = ['hello, world!', ' !hello! world!!,..#', '#hello!world'] | ||
for sent in sentences: | ||
assert list(tokenize_text(sent)) == ['hello', 'world'] | ||
|
||
assert list(tokenize_text("don't wouldn't")) == ['do', 'not', 'would', 'not'] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from type_infer.base import BaseEngine | ||
|
||
|
||
class BERType(BaseEngine): | ||
def __init__(self, stable=False): | ||
super().__init__(stable=stable) | ||
|
||
def infer(self, df): | ||
raise NotImplementedError |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,5 @@ class dtype: | |
empty = "empty" | ||
invalid = "invalid" | ||
|
||
# TODO: introduce "modifiers"? | ||
|
||
# TODO: modifier class + system |
Oops, something went wrong.