Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ci.yml #107

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.7, 3.8, 3.9]
python: ">=3.7,<3.11"

steps:
- name: Checkout the repository
Expand Down
47 changes: 13 additions & 34 deletions maha/cleaners/functions/contains_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,19 @@

import regex as re

from maha.constants import (
ALL_HARAKAT,
ARABIC,
ARABIC_LETTERS,
ARABIC_LIGATURES,
ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS,
EMPTY,
ENGLISH,
ENGLISH_CAPITAL_LETTERS,
ENGLISH_LETTERS,
ENGLISH_NUMBERS,
ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS,
HARAKAT,
LAM_ALEF,
LAM_ALEF_VARIATIONS,
NUMBERS,
PERSIAN,
PUNCTUATIONS,
SPACE,
TATWEEL,
)
from maha.expressions import (
EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS,
EXPRESSION_EMAILS,
EXPRESSION_EMOJIS,
EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS,
EXPRESSION_HASHTAGS,
EXPRESSION_LINKS,
EXPRESSION_MENTIONS,
)
from maha.constants import (ALL_HARAKAT, ARABIC, ARABIC_LETTERS,
ARABIC_LIGATURES, ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS, EMPTY, ENGLISH,
ENGLISH_CAPITAL_LETTERS, ENGLISH_LETTERS,
ENGLISH_NUMBERS, ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS, HARAKAT, LAM_ALEF,
LAM_ALEF_VARIATIONS, NUMBERS, PERSIAN,
PUNCTUATIONS, SPACE, TATWEEL)
from maha.expressions import (EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS, EXPRESSION_EMAILS,
EXPRESSION_EMOJIS, EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS, EXPRESSION_HASHTAGS,
EXPRESSION_LINKS, EXPRESSION_MENTIONS)
from maha.rexy import Expression, ExpressionGroup
from maha.utils import check_positive_integer

Expand Down
25 changes: 6 additions & 19 deletions maha/cleaners/functions/keep_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,12 @@
]

import maha.cleaners.functions as functions
from maha.constants import (
ALL_HARAKAT,
ARABIC,
ARABIC_LETTERS,
ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS,
EMPTY,
ENGLISH,
ENGLISH_CAPITAL_LETTERS,
ENGLISH_LETTERS,
ENGLISH_NUMBERS,
ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS,
HARAKAT,
NUMBERS,
PUNCTUATIONS,
SPACE,
TATWEEL,
)
from maha.constants import (ALL_HARAKAT, ARABIC, ARABIC_LETTERS,
ARABIC_NUMBERS, ARABIC_PUNCTUATIONS, EMPTY,
ENGLISH, ENGLISH_CAPITAL_LETTERS, ENGLISH_LETTERS,
ENGLISH_NUMBERS, ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS, HARAKAT, NUMBERS,
PUNCTUATIONS, SPACE, TATWEEL)


def keep(
Expand Down
27 changes: 7 additions & 20 deletions maha/cleaners/functions/normalize_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,13 @@


import maha.cleaners.functions as functions
from maha.constants import (
ALEF,
ALEF_MADDA_ABOVE,
ALEF_SUPERSCRIPT,
ALEF_VARIATIONS,
ARABIC_LIGATURES,
ARABIC_LIGATURES_NORMALIZED,
EMPTY,
HEH,
LAM,
LAM_ALEF_VARIATIONS,
LAM_ALEF_VARIATIONS_NORMALIZED,
MADDAH_ABOVE,
SPACE,
TEH_MARBUTA,
WAW,
WAW_VARIATIONS,
YEH,
YEH_VARIATIONS,
)
from maha.constants import (ALEF, ALEF_MADDA_ABOVE, ALEF_SUPERSCRIPT,
ALEF_VARIATIONS, ARABIC_LIGATURES,
ARABIC_LIGATURES_NORMALIZED, EMPTY, HEH, LAM,
LAM_ALEF_VARIATIONS,
LAM_ALEF_VARIATIONS_NORMALIZED, MADDAH_ABOVE,
SPACE, TEH_MARBUTA, WAW, WAW_VARIATIONS, YEH,
YEH_VARIATIONS)
from maha.expressions import EXPRESSION_ALL_SPACES


Expand Down
46 changes: 12 additions & 34 deletions maha/cleaners/functions/remove_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,18 @@


import maha.cleaners.functions as functions
from maha.constants import (
ALL_HARAKAT,
ARABIC,
ARABIC_DOTLESS_MAP,
ARABIC_LETTERS,
ARABIC_LIGATURES,
ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS,
DOTLESS_NOON_GHUNNA,
EMPTY,
ENGLISH,
ENGLISH_CAPITAL_LETTERS,
ENGLISH_LETTERS,
ENGLISH_NUMBERS,
ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS,
HARAKAT,
NOON,
NUMBERS,
PUNCTUATIONS,
SPACE,
TATWEEL,
)
from maha.expressions import (
EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS,
EXPRESSION_EMAILS,
EXPRESSION_EMOJIS,
EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS,
EXPRESSION_HASHTAGS,
EXPRESSION_LINKS,
EXPRESSION_MENTIONS,
)
from maha.constants import (ALL_HARAKAT, ARABIC, ARABIC_DOTLESS_MAP,
ARABIC_LETTERS, ARABIC_LIGATURES, ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS, DOTLESS_NOON_GHUNNA, EMPTY,
ENGLISH, ENGLISH_CAPITAL_LETTERS, ENGLISH_LETTERS,
ENGLISH_NUMBERS, ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS, HARAKAT, NOON, NUMBERS,
PUNCTUATIONS, SPACE, TATWEEL)
from maha.expressions import (EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS, EXPRESSION_EMAILS,
EXPRESSION_EMOJIS, EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS, EXPRESSION_HASHTAGS,
EXPRESSION_LINKS, EXPRESSION_MENTIONS)
from maha.rexy import Expression, ExpressionGroup
from maha.utils import check_positive_integer

Expand Down
15 changes: 2 additions & 13 deletions maha/cleaners/functions/replace_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,8 @@
# To enjoy infinite width lookbehind
import regex as re

from maha.constants import (
ARABIC_LETTERS,
ARABIC_NUMBERS,
BEH,
EMPTY,
ENGLISH_NUMBERS,
FEH,
KAF,
LAM,
SPACE,
TEH,
WAW,
)
from maha.constants import (ARABIC_LETTERS, ARABIC_NUMBERS, BEH, EMPTY,
ENGLISH_NUMBERS, FEH, KAF, LAM, SPACE, TEH, WAW)
from maha.rexy import Expression, ExpressionGroup


Expand Down
15 changes: 3 additions & 12 deletions maha/expressions/arabic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,9 @@
__all__ = ["EXPRESSION_ARABIC_HASHTAGS", "EXPRESSION_ARABIC_MENTIONS"]
import re

from maha.constants import (
ALL_HARAKAT,
AND_SIGN,
ARABIC_LETTERS,
ARABIC_NUMBERS,
AT_SIGN,
ENGLISH_NUMBERS,
HASHTAG,
PUNCTUATIONS,
TATWEEL,
UNDERSCORE,
)
from maha.constants import (ALL_HARAKAT, AND_SIGN, ARABIC_LETTERS,
ARABIC_NUMBERS, AT_SIGN, ENGLISH_NUMBERS, HASHTAG,
PUNCTUATIONS, TATWEEL, UNDERSCORE)
from maha.rexy import Expression

EXPRESSION_ARABIC_HASHTAGS = Expression(
Expand Down
11 changes: 2 additions & 9 deletions maha/expressions/english.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,8 @@

import re

from maha.constants import (
AND_SIGN,
AT_SIGN,
ENGLISH_LETTERS,
ENGLISH_NUMBERS,
HASHTAG,
PUNCTUATIONS,
UNDERSCORE,
)
from maha.constants import (AND_SIGN, AT_SIGN, ENGLISH_LETTERS,
ENGLISH_NUMBERS, HASHTAG, PUNCTUATIONS, UNDERSCORE)
from maha.rexy import Expression

EXPRESSION_ENGLISH_HASHTAGS = Expression(
Expand Down
18 changes: 4 additions & 14 deletions maha/expressions/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,10 @@

import re

from maha.constants import (
AND_SIGN,
ARABIC_COMMA,
ARABIC_DECIMAL_SEPARATOR,
ARABIC_NUMBERS,
ARABIC_THOUSANDS_SEPARATOR,
AT_SIGN,
COMMA,
ENGLISH_NUMBERS,
HASHTAG,
PUNCTUATIONS,
SPACE,
UNDERSCORE,
)
from maha.constants import (AND_SIGN, ARABIC_COMMA, ARABIC_DECIMAL_SEPARATOR,
ARABIC_NUMBERS, ARABIC_THOUSANDS_SEPARATOR,
AT_SIGN, COMMA, ENGLISH_NUMBERS, HASHTAG,
PUNCTUATIONS, SPACE, UNDERSCORE)
from maha.rexy import Expression

EXPRESSION_HASHTAGS = Expression(
Expand Down
10 changes: 2 additions & 8 deletions maha/parsers/functions/parse_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
__all__ = ["parse_dimension"]


from maha.parsers.rules import (
RULE_DISTANCE,
RULE_DURATION,
RULE_NAME,
RULE_NUMERAL,
RULE_ORDINAL,
RULE_TIME,
)
from maha.parsers.rules import (RULE_DISTANCE, RULE_DURATION, RULE_NAME,
RULE_NUMERAL, RULE_ORDINAL, RULE_TIME)
from maha.parsers.templates import Dimension, DimensionType
from maha.rexy import Expression

Expand Down
43 changes: 12 additions & 31 deletions maha/parsers/functions/parse_fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,18 @@

__all__ = ["parse", "parse_expression"]

from maha.constants import (
ALL_HARAKAT,
ARABIC,
ARABIC_LETTERS,
ARABIC_LIGATURES,
ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS,
EMPTY,
ENGLISH,
ENGLISH_CAPITAL_LETTERS,
ENGLISH_LETTERS,
ENGLISH_NUMBERS,
ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS,
HARAKAT,
NUMBERS,
PUNCTUATIONS,
SPACE,
TATWEEL,
)
from maha.expressions import (
EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS,
EXPRESSION_EMAILS,
EXPRESSION_EMOJIS,
EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS,
EXPRESSION_HASHTAGS,
EXPRESSION_LINKS,
EXPRESSION_MENTIONS,
)
from maha.constants import (ALL_HARAKAT, ARABIC, ARABIC_LETTERS,
ARABIC_LIGATURES, ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS, EMPTY, ENGLISH,
ENGLISH_CAPITAL_LETTERS, ENGLISH_LETTERS,
ENGLISH_NUMBERS, ENGLISH_PUNCTUATIONS,
ENGLISH_SMALL_LETTERS, HARAKAT, NUMBERS,
PUNCTUATIONS, SPACE, TATWEEL)
from maha.expressions import (EXPRESSION_ARABIC_HASHTAGS,
EXPRESSION_ARABIC_MENTIONS, EXPRESSION_EMAILS,
EXPRESSION_EMOJIS, EXPRESSION_ENGLISH_HASHTAGS,
EXPRESSION_ENGLISH_MENTIONS, EXPRESSION_HASHTAGS,
EXPRESSION_LINKS, EXPRESSION_MENTIONS)
from maha.parsers.templates import Dimension, DimensionType, TextExpression
from maha.rexy import Expression, ExpressionGroup

Expand Down
11 changes: 3 additions & 8 deletions maha/parsers/rules/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@
from maha.constants import ALEF_VARIATIONS, ARABIC_COMMA, COMMA, LAM, WAW
from maha.expressions import EXPRESSION_SPACE, EXPRESSION_SPACE_OR_NONE
from maha.parsers.templates import Unit, Value
from maha.rexy import (
Expression,
ExpressionGroup,
non_capturing_group,
optional_non_capturing_group,
positive_lookahead,
positive_lookbehind,
)
from maha.rexy import (Expression, ExpressionGroup, non_capturing_group,
optional_non_capturing_group, positive_lookahead,
positive_lookbehind)


@dataclass
Expand Down
10 changes: 3 additions & 7 deletions maha/parsers/rules/distance/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
from maha.parsers.templates import FunctionValue
from maha.rexy import ExpressionGroup, named_group, non_capturing_group

from ..common import (
FRACTIONS,
combine_patterns,
get_fractions_of_unit_pattern,
spaced_patterns,
wrap_pattern,
)
from ..common import (FRACTIONS, combine_patterns,
get_fractions_of_unit_pattern, spaced_patterns,
wrap_pattern)
from .template import DistanceValue
from .values import *

Expand Down
15 changes: 4 additions & 11 deletions maha/parsers/rules/duration/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,13 @@
]


from maha.parsers.rules.numeral.rule import (
EXPRESSION_NUMERAL_MAP,
RULE_NUMERAL,
_parse_numeral,
)
from maha.parsers.rules.numeral.rule import (EXPRESSION_NUMERAL_MAP,
RULE_NUMERAL, _parse_numeral)
from maha.parsers.templates import FunctionValue, Unit
from maha.rexy import ExpressionGroup, named_group, non_capturing_group

from ..common import (
FRACTIONS,
combine_patterns,
get_fractions_of_unit_pattern,
spaced_patterns,
)
from ..common import (FRACTIONS, combine_patterns,
get_fractions_of_unit_pattern, spaced_patterns)
from .template import *
from .values import *

Expand Down
Loading