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

Conversation

KelvynCarbone
Copy link

Choice language option.

Go, turminha! :P

@Vinicius-CS
Copy link

Boaah

@Patricia7sp
Copy link

ola pessoal, @VinyciusC @KelvynCarbone , o meu esta dando erro - esta dizendo que a linguagem nao foi definida

node:13503) UnhandledPromiseRejectionWarning: ReferenceError: askAndReturnLanguage is not defined
at start (/home/patricia/rob-s-maker/index.js:11:3)
at Object. (/home/patricia/rob-s-maker/index.js:36:1)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
(node:13503) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13503) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@Patricia7sp
Copy link

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

await robots.text(content)

function askAndReturnSearchTerm() {
return readline.question('Type a Wikipedia search term: ')
}

function askAndReturnPrefix() {
const prefixes = ['Who is', 'What is', 'The history of', 'What is its importance?', 'where to buy?']
const selectedPrefixIndex = readline.keyInSelect(prefixes, 'Choose one option: ')
const selectedPrefixText = prefixes[selectedPrefixIndex]

  function askAndReturnLanguage(){
    const  language = ['pt', 'en']
    const selectedLangIndex = readLine.keyInSelect(language,'choice language: ')
    const selectedLangText = language[selectedLangIndex]
    return selectedLangText
  }

}

console.log(content)
}

start()
`

@Patricia7sp
Copy link

`
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({
"lang": content.lang,
"articleName": content.searchTerm
})
const wikipediaContent = wikipediaResponde.get()

content.sourceContentOriginal = wikipediaContent.content

}`

@Vinicius-CS
Copy link

@Patricia7sp
function askAndReturnLanguage(){ const language = ['pt', 'en'] const selectedLangIndex = readLine.keyInSelect(language,'choice language: ') const selectedLangText = language[selectedLangIndex] return selectedLangText }

Nessa parte aqui
const selectedLangIndex = readLine.keyInSelect(language,'choice language: ')

Muda para
const selectedLangIndex = readline.keyInSelect(language,'Choice Language: ')

Ali em readline.keyInSelect no seu o "l" etá maiúsculo!

@Patricia7sp
Copy link

Patricia7sp commented Mar 18, 2019

@VinyciusC @KelvynCarbone Muito obrigada pelo retorno, obrigada pela observacao tambem, o erro ainda permanece, pois esta nesta parte aqui

const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)
    const wikipediaResponde = await wikipediaAlgorithm.pipe({
      "lang" : content.lang,
      "articleName": content.searchTerm

na parte de const wikipediaResponde = esta variavel esta repitada duas vezes e o terminal acusa isso.
Eu acrescentei lang ao final de responde para poder diferenciar da variavel de cima, nao sei se ira rodar perfeitamente o codigo depois.

@nandumoura
Copy link

Que da hora esse pull request

@Vinicius-CS
Copy link

@Patricia7sp apaga essa linha:

const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)

@mrleandro
Copy link

@VinyciusC @KelvynCarbone Muito obrigada pelo retorno, obrigada pela observacao tambem, o erro ainda permanece, pois esta nesta parte aqui

const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)
    const wikipediaResponde = await wikipediaAlgorithm.pipe({
      "lang" : content.lang,
      "articleName": content.searchTerm

na parte de const wikipediaResponde = esta variavel esta repitada duas vezes e o terminal acusa isso.
Eu acrescentei lang ao final de responde para poder diferenciar da variavel de cima, nao sei se ira rodar perfeitamente o codigo depois.

O problema provavelmente é só o nome ... esta como "responde" e o resto do programa é "response"

@KelvynCarbone
Copy link
Author

Deu tudo certo, galera?

@Patricia7sp
Copy link

@KelvynCarbone Agora Deu, fizemos os ajustes. Muito obrigada.


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 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()

@thiagobutignon
Copy link

Uma dúvida, o watson no nlp não reconhece a tradução. Como proceder?

@Patricia7sp
Copy link

@thiagobutignon , realmente, as traducoes nao estao ocorrendo, @KelvynCarbone o que podemos fazer?

@Fragna
Copy link

Fragna commented Mar 29, 2019

Muito bom, funcionou certinho 👍

@MoreiraTv
Copy link

To tento uma problema, quando me retorna o texto do Wikipedia ta vindo o texto substituto da imagem que tem no site junto, ae fica mais ou menos assim:
{}{1}^{2}{\mathrm {D}}+{}{{\ 92}}^{{238}}{\mathrm {U}}\to {}{{\ 93}}^{{240}}{\mathrm {Np}}^{*}\to 2\ {}{0}^{1}{\mathrm {n}}+(\ {}{{\ 93}}^{{238}}{\mathrm {Np}}\to {}{{\ 94}}^{{238}}{\mathrm {Pu}}+{\mathrm {e}}^{-}+{\bar {\nu _{{\mathrm {e}}}}}\ )

Esse texto fica na chave img do html do site, más ta vindo no text do programa. Como posso ta filtrando isso ?

A pesquisa que fiz no programa foi Uranio, ae esses texto alternativo vem devido a imagem da formula.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants