Skip to content

Commit

Permalink
Merge pull request #86 from UnB-KnEDLe/tests
Browse files Browse the repository at this point in the history
Adding Coveralls and Basic Tests to Repo
  • Loading branch information
Skalwalker committed Oct 12, 2020
2 parents 3de2740 + 6497ded commit 6aa3663
Show file tree
Hide file tree
Showing 12 changed files with 2,157 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ python:
install:
- pip3 install -r requirements.txt
script:
- pytest tests
- pytest --cov=dodfminer tests
after_success:
- coveralls
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Maintainability](https://api.codeclimate.com/v1/badges/a8ab63922f34a63be4cb/maintainability)](https://codeclimate.com/github/UnB-KnEDLe/DODFMiner/maintainability)
[![Documentation Status](https://readthedocs.org/projects/dodfminer/badge/?version=latest)](https://dodfminer.readthedocs.io/en/latest/?badge=latest)
[![Coverage Status](https://coveralls.io/repos/github/UnB-KnEDLe/DODFMiner/badge.svg)](https://coveralls.io/github/UnB-KnEDLe/DODFMiner)

### DODFMiner

Expand All @@ -12,7 +13,7 @@ DODFMiner is the software that is being developed for the extraction of data fro
### Contribute

If you want to contribute to our project, it's simple! We have a [Contribution Guide](CONTRIBUTING.md) where all the steps to contribute are explained.
Don't forget to also read our [Code of Conduct](CODE_OF_CONDUCT.md).
Don't forget to also read our [Code of Conduct](CODE_OF_CONDUCT.md).
If you have any questions you can also contact us by creating an issue or by ask.knedle@googlegroups.com

### Installation
Expand Down
3 changes: 3 additions & 0 deletions dodfminer/extract/polished/backend/ner.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ActNER:
"""

def __init__(self):
self._backend = 'regex'
super(ActNER, self).__init__()
self._model = self._load_model()

Expand All @@ -37,6 +38,8 @@ def _load_model(self):
if self._backend == 'ner':
print(f"Act {self._name} does not have an model: FALLING BACK TO REGEX")
self._backend = 'regex'
else:
self._backend = 'regex'

def _get_features(self, act):
"""Create features for each word in act.
Expand Down
8 changes: 7 additions & 1 deletion dodfminer/extract/polished/backend/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class ActRegex:
"""

def __init__(self):
# Attributes to be overrided by child
# self._name = None
# self._acts_str = []
# self._text = None

#Act Regex Constuction
super(ActRegex, self).__init__()
self._flags = self._regex_flags()
self._rules = self._prop_rules()
Expand Down Expand Up @@ -72,7 +78,7 @@ def _regex_instances(self):
results = []
for instance in found:
head, body = instance
self.acts_str.append(head+body)
self._acts_str.append(head+body)
results.append(body)

return results
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ joblib==0.16.0
sklearn_crfsuite==0.3.6
lxml==4.5.2
pytest==6.0.2
pytest-cov==2.10.1
pytest-mock==3.3.1
coveralls==2.1.2
Binary file added tests/support/invalid.pdf
Binary file not shown.
Binary file added tests/support/test_model.pkl
Binary file not shown.
1,251 changes: 1,251 additions & 0 deletions tests/support/valid.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 6aa3663

Please sign in to comment.