curran / curran/google-diff-match-patch

JS library gives wrong result.

Aperta
#110 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
auto-migrated Priority-Medium Type-Defect
Lingua principale
Python
Stelle
17
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

```
What steps will reproduce the problem?

var context = "It's easy as pie to use Mathjax. You just need to study and
remember how to use $$ and $$$. As you can see, it's not that hard. So, let's
try something a bit more complicated.\nHere was a line break with two spaces.
Not that hard, right, grandpa?";
var anchorText = "just need to study and remember how to use $$ and";
var dmp = new diff_match_patch();
dmp.Match_MaxBits = 100;
var offset = dmp.match_main(context, anchorText, 60);
// offset = 69
// meaning: the match starts with "how to use $$ and $$$. As you can see,"

What is the expected output? What do you see instead?

I think offset should be 37, since that'll result in a perfect match. I also
can't figure out a way to change Distance or Threshold parameters to cause that
to happen. The only thing that works is changing the guess parameter ("60") to
be smaller / closer to "37", but I unfortunately don't have that information
for a generic case.

What version of the product are you using? On what operating system?
JavaScript; latest version

Please provide any additional information below.

```

Original issue reported on code.google.com by `alexei.a...@gmail.com` on 19 Jul 2015 at 8:35

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia riproducendo lo snippet JavaScript nel punto di ingresso match_main con i valori forniti di context, anchorText, guess, Match_MaxBits, Distance e Threshold. Confronta l’offset restituito con il valore segnalato 69 e quello previsto 37, quindi determina e documenta il comportamento previsto dei parametri; il lavoro è completo quando la discrepanza per questo caso generico ha una risoluzione concordata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.