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

Choice language #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ async function start() {

content.searchTerm = askAndReturnSearchTerm()
content.prefix = askAndReturnPrefix()
content.lang = askAndReturnLanguage()

await robots.text(content)

Expand All @@ -23,6 +24,13 @@ async function start() {
return selectedPrefixText
}

function askAndReturnLanguage(){
const language = ['pt','en']
const selectedLangIndex = readline.keyInSelect(language,'Choice Language: ')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Que tal trocar esse input pra "Choose Language: "?
Choice é usado como substantivo, ex: na frase "I had no choice" - Eu não tive escolha

const selectedLangText = language[selectedLangIndex]
return selectedLangText
}

console.log(content)
}

Expand Down
5 changes: 4 additions & 1 deletion robots/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ async function robot(content) {
async function fetchContentFromWikipedia(content) {
const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey)
const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2')
const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)
const wikipediaResponde = await wikipediaAlgorithm.pipe({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modificar o wikipediaResponde para wikipediaResponse

Suggested change
const wikipediaResponde = await wikipediaAlgorithm.pipe({
const wikipediaResponse = await wikipediaAlgorithm.pipe({

"lang" : content.lang,
"articleName": content.searchTerm
})
const wikipediaContent = wikipediaResponde.get()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modificar o wikipediaResponde.get() para wikipediaResponse.get()

Suggested change
const wikipediaContent = wikipediaResponde.get()
const wikipediaContent = wikipediaResponse.get()


content.sourceContentOriginal = wikipediaContent.content
Expand Down