News for hackers. Stuff that matters.
Re:Using aligned word vectors for instant translations with ... by beau on Thursday June 10, 2021 @04:38PM (#27465483)
We've released the underlying Rust implementation here: https://github.com/InstantDomain/instant-distance with Python bindings at https://pypi.org/project/instant-distance — feedback welcome!
Re:Using aligned word vectors for instant translations with ... by habibur on Thursday June 10, 2021 @07:26PM (#27467375)
For Linux, in the Makefile change the copy command to

cp target/release/libinstant_distance.so instant-distance-py/test/instant_distance.so

and it works. Built and running. The main tree was MacOS only.

Here's resource consumption in a sample run.

Time: 4.49s, Memory: 1552 mb.

Single word. Three langs including en.

Re:Using aligned word vectors for instant translations with ... by planckscnst on Thursday June 10, 2021 @08:51PM (#27468017)
How did you figure this out? I've done lots of Linux software build troubleshooting as a result of using Gentoo, BuildRoot, and pacaur, but this doesn't ring any bells for a common issue
Re:Using aligned word vectors for instant translations with ... by fnord123 on Friday June 11, 2021 @02:59AM (#27470159)
They probably tried it, it couldn't find a dynlib which is a Macos shared object file, opened the three line makefile, and then fixed it to copy a .so
Re:Using aligned word vectors for instant translations with ... by arbol on Thursday June 10, 2021 @07:18PM (#27467298)
Did you try spacy's most similar method? It's written in cython so is presumably quite fast as well. Thanks for the rust implementation though, I will most likely use this.
Re:Using aligned word vectors for instant translations with ... by Fiahil on Thursday June 10, 2021 @06:05PM (#27466414)
I’ve not much to say on the actual lib, it seems great! However, don’t feel compelled to put all your rust code into a single lib.rs. You can split your work into several files and use ‘pub use’ and ‘mod’ in lib.rs to re-export your functions & types into a public API of your choosing.

cargo check and format time might also slightly improve!

Re:Using aligned word vectors for instant translations with ... by ibraheemdev on Thursday June 10, 2021 @11:45PM (#27469065)
Funny, I often say the opposite. Don't feel compelled to split up your lib.rs. It's really refreshing to see a nice, compact library in one or two files. Much easier to follow, especially over "type per file". Of course, there are limits, but for a small lib like this, I personally would keep it in a single, or maybe two files.
Re:Using aligned word vectors for instant translations with ... by dochtman on Friday June 11, 2021 @12:50AM (#27469412)
I have a fair bit of experience writing Rust code and the current status is totally deliberate. I find module file sizes of about 400-800 lines of code optimal in terms of my ability to find things vs the unnecessary complexity of having to skip around files when changing something that touches an API boundary.
Re:Using aligned word vectors for instant translations with ... by maeln on Friday June 11, 2021 @03:10AM (#27470215)
This webpage use a significant amount of CPU constantly for no apparent reason (as far as I can see it is mostly a static webpage). What the hell ? Is it mining crypto in the background ?
Re:Using aligned word vectors for instant translations with ... by maybevain on Friday June 11, 2021 @04:18AM (#27470603)
At a quick glance it seems like some React component is constantly re-rending.

Quick glance in this case: took a couple second snapshot on the Performance tab and saw a lot of React related calls.

Re:Using aligned word vectors for instant translations with ... by beau on Friday June 11, 2021 @10:42AM (#27474031)
Sorry, this page had a useEffect/setState render loop. We are running react@experimental with concurrent mode, and missed the error. Rolling out a fix now. Thanks!
Re:Using aligned word vectors for instant translations with ... by chakkepolja on Friday June 11, 2021 @03:24AM (#27470296)
Compiling rust.
Re:Using aligned word vectors for instant translations with ... by denysvitali on Thursday June 10, 2021 @05:52PM (#27466286)
> For example, here are the results of translating the English word "hello":

> Language: fr, Translation: bonjours

> Language: fr, Translation: bonsoir

> Language: fr, Translation: salutations

> Language: it, Translation: buongiorno

> Language: it, Translation: buonanotte

> Language: fr, Translation: rebonjour

> Language: it, Translation: auguri

> Language: fr, Translation: bonjour,

> Language: it, Translation: buonasera

> Language: it, Translation: chiamatemi

Is it just me or these machine translations are worse than ... Google Translate?

Re:Using aligned word vectors for instant translations with ... by beau on Thursday June 10, 2021 @07:00PM (#27467045)
These results are less accurate than Google Translate. But they are far faster to get, and far less expensive to generate: https://cloud.google.com/translate/pricing — our goal is here is speed. We want to search through many possibilities as quickly as possible.

The word vectors have been aligned in multiple languages. Using an approximate nearest neighbor search we are able to find the nearest vector to the input in multiple languages very quickly.

To keep the example simple, we did not try to filter the data through hand-built language dictionaries. In fact, we simply drop words in other languages that also appear in the English .vec file. Words like "ciao" appear frequently enough in otherwise English sentences that the example code drops it from Italian, and so is not shown in the results:

% curl -s "https://dl.fbaipublicfiles.com/fasttext/vectors-aligned/wiki..." | grep -n ciao 50393:ciao 0.0120 ...

One improvement would be to filter out any words that do not appear in a hand-curated dictionary instead of filtering out words that already appear in English. We decided not to show how to do this because we'd already introduced a few concepts, like aligned word vectors, approximate nearest neighbour searches, and wanted to keep the example as simple as possible.

Re:Using aligned word vectors for instant translations with ... by toxik on Thursday June 10, 2021 @05:54PM (#27466308)
Google Translate is state of the art, so I’m not sure why that would be surprising. That said, is there something wrong with the translations offered?
Re:Using aligned word vectors for instant translations with ... by shakow on Thursday June 10, 2021 @07:09PM (#27467178)
> Google Translate is state of the art

For French/English/German, DeepL is much better IME.

Re:Using aligned word vectors for instant translations with ... by dataflow on Thursday June 10, 2021 @06:02PM (#27466391)
> That said, is there something wrong with the translations offered?

I think in French hello = "bonjour" and hi = "salut"... not sure where "bonjours" and "salutations" came from.

Re:Using aligned word vectors for instant translations with ... by T-A on Thursday June 10, 2021 @06:15PM (#27466512)
The Italian "auguri" means "best wishes"; "chiamatemi" means "call me". Neither is a plausible translation of "hello". The obvious one, "ciao", is missing.
Re:Using aligned word vectors for instant translations with ... by e17 on Friday June 11, 2021 @05:17AM (#27470983)
I thought Hello was invented with the telephone. Prior to that, English greetings were good morning/evening. What do Italians and French say when they pick up the phone? Allora?
Re:Using aligned word vectors for instant translations with ... by shakow on Thursday June 10, 2021 @07:11PM (#27467198)
"Bonjours" doesn't exist, and "salutations" is a tad quirky, but OK in informal settings, especially when addressing many people at once.
Re:Using aligned word vectors for instant translations with ... by tasogare on Thursday June 10, 2021 @08:13PM (#27467752)
No, bonjours exists (it's simply the plural form of bonjour used as a noun) but the contexts it is used are very very infrequent so it's weird to find it in that list.
Re:Using aligned word vectors for instant translations with ... by a1369209993 on Thursday June 10, 2021 @09:11PM (#27468165)
Compare "I said my hellos and goodbyes." in English. It's definitely a word, just so uncommon as to be largely irrelevant in most practical contexts.
Re:Using aligned word vectors for instant translations with ... by toxik on Friday June 11, 2021 @06:17AM (#27471377)
It's very clearly semantically related though? I don't understand the complaint here.
Re:Using aligned word vectors for instant translations with ... by numpad0 on Friday June 11, 2021 @01:51AM (#27469783)
It seems to be a very domain specific solution, they are trying to present versions of words in customer requested domain names if already taken.

Like you type in “stargazer. com”, system sees it’s already registered, and returns a “sorry sir it’s taken” page, with similar words listed as “but maybe try these words: astronomer, observatory, telescope, shooting star...”.

So it’s not serious translation, more of an inexpensive quick dictionary search. I guess it’s okay for its intended purposes.

Re:Using aligned word vectors for instant translations with ... by ampdepolymerase on Thursday June 10, 2021 @06:23PM (#27466602)
It would be better to run the vectors through an attention layer if you want sentence to sentence translation.
Re:Using aligned word vectors for instant translations with ... by fulafel on Friday June 11, 2021 @12:14AM (#27469221)
Was disappointed this can't translate from Python to Rust.
Re:Using aligned word vectors for instant translations with ... by dukeofdoom on Thursday June 10, 2021 @09:28PM (#27468305)
Can something like this be done to compare/translate subsequences COVID genetic code to SARS and other virus genetic codes. Would be interesting how much overlap there is. And would further the research into where it came from.

Full genome of COVID-19 is available:

https://www.snapgene.com/resources/coronavirus-resources/?re...

Re:Using aligned word vectors for instant translations with ... by nestorD on Friday June 11, 2021 @01:43AM (#27469734)
Bioinformaticists have been able to do that with traditional algorithms for years (dynamic programming gets you a long way to compute an edit distance for example).

It is probably the first thing that was done once the COVID-19 genome was made public. A quick googling gave me that summary of the results: https://www.news-medical.net/health/How-Does-the-SARS-Virus-...

Re:Using aligned word vectors for instant translations with ... by dukeofdoom on Friday June 11, 2021 @08:13AM (#27472230)
Great article, thank you
Re:Using aligned word vectors for instant translations with ... by mattkrause on Friday June 11, 2021 @10:08AM (#27473541)
It sounds like you're thinking of "sequence alignment", which is a pretty standard bioinformatics tool.

BLAST (=Basic Local Alignment Search Tool) is one common version, and the NIH'S NCBI has a variety of nice online tools here: https://blast.ncbi.nlm.nih.gov/Blast.cgi

Note that it does take a little bit of background knowledge to interpret:some motifs are just really common, others are shared.

Re:Using aligned word vectors for instant translations with ... by PaulHoule on Thursday June 10, 2021 @04:38PM (#27465479)
Nice example.

The short text and that fact that your application would tolerate or celebrate catchy neologisms plays to fasttext's strengths.

Re:Using aligned word vectors for instant translations with ... by beau on Thursday June 10, 2021 @04:59PM (#27465755)
Thank you!
Re:Using aligned word vectors for instant translations with ... by shakow on Thursday June 10, 2021 @07:12PM (#27467211)
> fast translates to vite in French

Only as an adverb, it should be "rapide" otherwise.

Re:Using aligned word vectors for instant translations with ... by aitk on Thursday June 10, 2021 @06:18PM (#27466544)
At first glance at the title, I thought it was translating Python code to Rust code.
Re:Using aligned word vectors for instant translations with ... by adsharma on Thursday June 10, 2021 @07:42PM (#27467515)
It may not be a bad candidate for writing the rust part in python and then running it through py2many to generate the rust.