Skip to content

Commit

Permalink
Project Structure Changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritik Jain authored and neomatrix369 committed Oct 21, 2020
1 parent 36eda6f commit 3a2a9b0
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion nlp_profiler/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
SPACES_COUNT_COL = 'spaces_count'
CHARACTERS_COUNT_COL = 'characters_count'
SENTENCES_COUNT_COL = 'sentences_count'
NOUN_PHASE_COUNT_COL = 'noun_phase_count'
NOUN_PHASE_COUNT_COL = 'noun_phase_count'
10 changes: 6 additions & 4 deletions nlp_profiler/granular_features/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import pandas as pd

from nlp_profiler.constants import \
ALPHA_NUMERIC_COUNT_COL, WHOLE_NUMBERS_COUNT_COL, EMOJI_COUNT_COL, CHARS_EXCL_SPACES_COUNT_COL
from nlp_profiler.constants import CHARACTERS_COUNT_COL, SENTENCES_COUNT_COL
from nlp_profiler.constants import \
DATES_COUNT_COL, STOP_WORDS_COUNT_COL, PUNCTUATIONS_COUNT_COL, NON_ALPHA_NUMERIC_COUNT_COL
from nlp_profiler.constants import \
DEFAULT_PARALLEL_METHOD
from nlp_profiler.constants import DUPLICATES_COUNT_COL, WORDS_COUNT_COL, SPACES_COUNT_COL, NOUN_PHASE_COUNT_COL
from nlp_profiler.constants import \
DUPLICATES_COUNT_COL, COUNT_WORDS_COL, SPACES_COUNT_COL, \
ALPHA_NUMERIC_COUNT_COL, WHOLE_NUMBERS_COUNT_COL, EMOJI_COUNT_COL, CHARS_EXCL_SPACES_COUNT_COL, \
NOUN_PHASE_COUNT_COL
from nlp_profiler.generate_features import generate_features
from nlp_profiler.granular_features.alphanumeric import count_alpha_numeric
from nlp_profiler.granular_features.chars_and_spaces \
Expand All @@ -16,6 +17,7 @@
from nlp_profiler.granular_features.duplicates import count_duplicates
from nlp_profiler.granular_features.emojis import count_emojis
from nlp_profiler.granular_features.non_alphanumeric import count_non_alpha_numeric
from nlp_profiler.granular_features.noun_phase_count import count_noun_phase
from nlp_profiler.granular_features.numbers import count_whole_numbers
from nlp_profiler.granular_features.punctuations import count_punctuations
from nlp_profiler.granular_features.sentences import count_sentences
Expand All @@ -31,7 +33,7 @@ def apply_granular_features(heading: str,
(SENTENCES_COUNT_COL, text_column, count_sentences),
(CHARACTERS_COUNT_COL, text_column, count_chars),
(SPACES_COUNT_COL, text_column, count_spaces),
(WORDS_COUNT_COL, text_column, count_words),
(COUNT_WORDS_COL, text_column, count_words),
(DUPLICATES_COUNT_COL, text_column, count_duplicates),
(CHARS_EXCL_SPACES_COUNT_COL, text_column, count_characters_excluding_spaces),
(EMOJI_COUNT_COL, text_column, count_emojis),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion slow-tests/performance_tests/test_perf_noun_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import git

sys.path.insert(0, '../../performance-tests/high_level')
from nlp_profiler.noun_phase_count import count_noun_phase
from nlp_profiler.granular_features.noun_phase_count import count_noun_phase
from line_profiler import LineProfiler

CURRENT_SOURCE_FILEPATH = os.path.abspath(__file__)
Expand Down
6 changes: 3 additions & 3 deletions test-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ run_test_runner() {
${RUN_PYTEST} --cov-config pyproject.toml \
--cov-report html:"${COVERAGE_REPORT_FOLDER}" \
--cov=${SOURCES_FOLDER} ${TARGET_TEST_FOLDERS} \
--html="${TEST_REPORT_FILE}" \
|| test_run_exit_code="$?" && true
--html="${TEST_REPORT_FILE}" \
|| test_run_exit_code="$?" && true
set +x
echo ""; echo "~~~ The test report file created: ${TEST_REPORT_FILE}";
echo ""; echo "~~~ The test coverage report can be found by opening: ${COVERAGE_REPORT_FILE}"
Expand All @@ -75,4 +75,4 @@ delete_the_old_coverage_report_folder_and_create_a_new_one
run_test_runner
print_finish_time

exit ${test_run_exit_code}
exit ${test_run_exit_code}
2 changes: 1 addition & 1 deletion tests/acceptance_tests/test_apply_text_profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ def create_source_dataframe():
'I think they have a good trait.'
data = [text_with_emojis, text_with_a_number, text_with_two_numbers,
text_with_punctuations, text_with_a_date, text_with_dates, text_with_duplicates]
return pd.DataFrame(data, columns=['text'])
return pd.DataFrame(data, columns=['text'])
3 changes: 1 addition & 2 deletions tests/granular/test_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import pytest

from nlp_profiler.constants import NaN
from nlp_profiler.granular_features.duplicates \
import gather_duplicates, count_duplicates # noqa
from nlp_profiler.granular_features.duplicates import gather_duplicates, count_duplicates # noqa

text_with_a_number = '2833047 people live in this area'
text_with_duplicates = 'Everyone here is so hardworking. hardworking people. ' \
Expand Down
2 changes: 1 addition & 1 deletion tests/granular/test_nounphase.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import numpy as np

from nlp_profiler.noun_phase_count import count_noun_phase, gather_nouns
from nlp_profiler.granular_features.noun_phase_count import count_noun_phase, gather_nouns
from nlp_profiler.constants import NaN


Expand Down
4 changes: 2 additions & 2 deletions tests/high_level/test_sentiment_polarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pytest

from nlp_profiler.constants import NOT_APPLICABLE, NaN
from nlp_profiler.high_level_features.sentiment_polarity \
import sentiment_polarity_score, sentiment_polarity_summarised, sentiment_polarity # noqa
from nlp_profiler.high_level_features.sentiment_polarity import sentiment_polarity_score, \
sentiment_polarity_summarised, sentiment_polarity # noqa

positive_text = "This sentence doesn't seem to too many commas, periods or semi-colons (;)."
negative_text = "2833047 people live in this area. It is not a good area."
Expand Down

0 comments on commit 3a2a9b0

Please sign in to comment.