Skip to content

Commit

Permalink
NEW FEATURE: Date Extract #6
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed May 18, 2020
1 parent 9e489e8 commit d8be1ea
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
'5': lambda: choices('frequency', CLIENT, TEXT),
'6': lambda: choices('count', CLIENT, TEXT),
'7': lambda: choices('email', CLIENT, TEXT),
'8': lambda: choices('date', CLIENT, TEXT)
}
selectChoice[choice]()
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ _Index_

- Contar número de palavras em um texto.

- Extrair emails presente no texto.

- Extrair datas presente no texto.

## Dependências:

### _Instale usando o arquivo de dependências do Python:_
Expand Down Expand Up @@ -135,8 +139,12 @@ Frequência: 8
- [WordCounter](https://algorithmia.com/algorithms/diego/WordCounter)

- [cindyxiaoxiaoli](https://algorithmia.com/users/cindyxiaoxiaoli)

- [EmailExtractor](https://algorithmia.com/algorithms/cindyxiaoxiaoli/EmailExtractor)

- [PetiteProgrammer](https://algorithmia.com/users/PetiteProgrammer)
- [DateExtractor](https://algorithmia.com/algorithms/PetiteProgrammer/DateExtractor)

---

<table align="center">
Expand Down
4 changes: 3 additions & 1 deletion choice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from functions.entityRecognition import entityRecognition
from functions.frequencyOfWords import frequencyOfWords
from functions.emailExtract import emailExtract
from functions.dateExtrac import dateExtractor


def choices(option: str, client: 'Client', text: str) -> NoReturn:
Expand All @@ -30,7 +31,8 @@ def choices(option: str, client: 'Client', text: str) -> NoReturn:
"count": lambda c, t: countWords(c, t),
"entity": lambda c, t: entityRecognition(c, t),
"frequency": lambda c, t: frequencyOfWords(c, t),
"email": lambda c, t: emailExtract(c, t)
"email": lambda c, t: emailExtract(c, t),
"date": lambda c, t: dateExtractor(c, t)
}
optionSelect[option](client, text)

Expand Down
18 changes: 18 additions & 0 deletions functions/dateExtrac.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import NoReturn, List


def dateExtractor(client: 'Client', text: str) -> NoReturn:
from utils.translate import traduzir
from interface import texts

print(texts.optionsTitle('date'))

translatedText = traduzir('en', text)
algorithm = client.algo('PetiteProgrammer/DateExtractor/0.1.0')
response: List[str] = algorithm.pipe(translatedText).result

if len(response) > 0:
for date in response:
print(date)
else:
print('Nenhuma data encontrada')
5 changes: 4 additions & 1 deletion interface/texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def choicesMenu(style: Dict[str, str]) -> str:
{style['bold']}6{style['reset']} < {style['italic']}Contar número de palavras em um texto.{style['reset']}
{style['bold']}7{style['reset']} < {style['italic']}Extrair emails presentes no texto.{style['reset']}
{style['bold']}8{style['reset']} < {style['italic']}Extrair datas presentes no texto.{style['reset']}
''')


Expand All @@ -86,7 +88,8 @@ def optionsTitle(option: str) -> str:
'count': '\nContando palavras...\n',
'entity': '\nExtraindo entidades...\n',
'frequency': '\nObtendo frequencia de cada palavra...\n',
'email': '\nExtraindo emails no texto...\n'
'email': '\nExtraindo emails no texto...\n',
'date': '\nExtraindo datas no texto...\n'
}
return textOfOptions[option]

Expand Down

0 comments on commit d8be1ea

Please sign in to comment.