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 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
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ async function start() {

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

await robots.text(content)

Expand All @@ -24,7 +25,12 @@ 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(JSON.stringify(content, null, 4))
}

Expand Down
8 changes: 5 additions & 3 deletions robots/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ async function robot(content) {
async function fetchContentFromWikipedia(content) {
const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey)
const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2')
const wikipediaResponse = await wikipediaAlgorithm.pipe(content.searchTerm)
const wikipediaContent = wikipediaResponse.get()

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