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

Accent mark handling #6

Open
clvLabs opened this issue Apr 27, 2019 · 3 comments
Open

Accent mark handling #6

clvLabs opened this issue Apr 27, 2019 · 3 comments

Comments

@clvLabs
Copy link

clvLabs commented Apr 27, 2019

When searching for words with accent marks, there's an odd behaviour:

$ docker run squat/drae define ficción
[{"word":"ficción","etymology":"Del lat. fictio, -ōnis.","definitions":[{"category":"nombre femenino","definition":"Acción y efecto de fingir","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Invención cosa fingida","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Clase de obras literarias o cinematográficas generalmente narrativas que tratan de sucesos y personajes imaginarios","origin":[],"notes":[],"examples":["Obra, libro de ficción."]}],"variations":[{"definitions":[{"category":"nombre femenino","definition":"ficción que introduce o autoriza la ley o la jurisprudencia en favor de alguien como cuando al hijo concebido se le tiene por nacido","origin":["Derecho"],"notes":[],"examples":[]},{"category":"","definition":"ciencia ficción","origin":[],"notes":[],"examples":[]}],"variation":"ficción de derecho, o ficción legal"}]}]

$ docker run squat/drae define ficcion
[{"word":"ficcion","etymology":"Del lat. fictio, -ōnis.","definitions":[{"category":"nombre femenino","definition":"Acción y efecto de fingir","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Invención cosa fingida","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Clase de obras literarias o cinematográficas generalmente narrativas que tratan de sucesos y personajes imaginarios","origin":[],"notes":[],"examples":["Obra, libro de ficción."]}],"variations":[{"definitions":[{"category":"nombre femenino","definition":"ficción que introduce o autoriza la ley o la jurisprudencia en favor de alguien como cuando al hijo concebido se le tiene por nacido","origin":["Derecho"],"notes":[],"examples":[]},{"category":"","definition":"ciencia ficción","origin":[],"notes":[],"examples":[]}],"variation":"ficción de derecho, o ficción legal"}]}]

$ docker run squat/drae define fíccion
[{"word":"fíccion","etymology":"Del lat. fictio, -ōnis.","definitions":[{"category":"nombre femenino","definition":"Acción y efecto de fingir","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Invención cosa fingida","origin":[],"notes":[],"examples":[]},{"category":"nombre femenino","definition":"Clase de obras literarias o cinematográficas generalmente narrativas que tratan de sucesos y personajes imaginarios","origin":[],"notes":[],"examples":["Obra, libro de ficción."]}],"variations":[{"definitions":[{"category":"nombre femenino","definition":"ficción que introduce o autoriza la ley o la jurisprudencia en favor de alguien como cuando al hijo concebido se le tiene por nacido","origin":["Derecho"],"notes":[],"examples":[]},{"category":"","definition":"ciencia ficción","origin":[],"notes":[],"examples":[]}],"variation":"ficción de derecho, o ficción legal"}]}]
  • In the first search (ficción), everything works as expected
  • In the second search (ficcion) the accent mark has been omitted and the search engine manages to find it anyway 👍 . But the returned object includes the wrong spelling in the word field
  • In the third example (fíccion) a wrong accent mark has been added and the same thing happens

Peekin'round the code found that the word used to generate the returned object is the same received by parameter - define.go:127

func scrape(url string, word string) ([]*Entry, error) {
// ...
			entries[k] = &Entry{
				Word:        word,
				Etymology:   etymology,
				Definitions: defs,
				Variations:  vars,
			}
// ...
	return entries, nil
}

Haven't gone thru the scraping details, but I guess the correct word spelling will be in the returned document.

It would be a very nice feature to have (I use drae very frequently) since sometimes I don't feel confident about having the spelling right even if I check the dictionary (so I have to go to the official site)

BTW, thanks a lot for drae!!!!

@clvLabs
Copy link
Author

clvLabs commented Apr 27, 2019

It goes even further...

$ docker run squat/drae define mono             
[{"word":"mono","etymology":"De mona1, y este quizá acort. de maimona, f. de maimón1 'mico'.","definitions":[{"category":"adjetivo coloquial","definition":"Dicho de una persona De aspecto agradable ...

$ docker run squat/drae define monete
[{"word":"monete","etymology":"De mona1, y este quizá acort. de maimona, f. de maimón1 'mico'.","definitions":[{"category":"adjetivo coloquial","definition":"Dicho de una persona De aspecto agradable ...

@squat
Copy link
Owner

squat commented Apr 11, 2020

@clvLabs so sorry I missed this notification from last year 😱! What would you like to see as the handling for this case? Should draw warn that the spelling has been corrected? Thank you for filing this issue :))

@squat
Copy link
Owner

squat commented Apr 11, 2020

Ah, or simply replace the "word" field with the corrected one returned by RAE 👍

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

No branches or pull requests

2 participants