Hi again,

El Martes, 28 de enero de 2014 19:39:56 David Suárez escribió:
> The code it's trying to convert an hexadecimal string to an integer.
> 
> line 296      -> @w_cnt = [data[3]].pack('H2')[0]
> changes to -> @w_cnt = data[3].hex
> 
> Please, check if the generated files are the same :)

Complete patch attached (sorry I didn't have access to any machine until now).

I diff the output of the two versions and they are some minor changes in the 
word ordering (first upper then lowercase), eg:

> +Zealot
> +     [m1][p]noun[/p][/m]
> +     [m2] [trn]a member of an ancient Jewish sect in Judea in the first 
> century 
> who fought to the death against the Romans and who killed or persecuted Jews 
> who collaborated with the Romans[/trn][/m]
> +     [m3][com][c darkgray]•[/c] [p]Hypernyms[/p]: <<Jew>>, <<Hebrew>>, 
<<Israelite>>[/com][/m]
>  zealot
>       [m1][p]noun[/p][/m]
>       [m2] [trn]a fervent and even militant proponent of something[/trn][/m]
> @@ -1276876,10 +1276880,6 @@
>       [m3][com][c dodgerblue]•[/c] [p]Derivationally related forms[/p]: 
<<partisanship>> [c darkgray](for: <<partisan>>)[/c][/com][/m]
>       [m3][com][c darkgray]•[/c] [p]Hypernyms[/p]: <<advocate>>, 
> <<advocator>>, 
<<proponent>>, <<exponent>>[/com][/m]
>       [m3][com][c darkgray]•[/c] [p]Hyponyms[/p]: <<bigot>>, <<dogmatist>>, 
<<doctrinaire>>[/com][/m]
> -Zealot
> -     [m1][p]noun[/p][/m]
> -     [m2] [trn]a member of an ancient Jewish sect in Judea in the first 
> century 
who fought to the death against the Romans and who killed or persecuted Jews 
who collaborated with the Romans[/trn][/m]
> -     [m3][com][c darkgray]•[/c] [p]Hypernyms[/p]: <<Jew>>, <<Hebrew>>, 
<<Israelite>>[/com][/m]
>  zealotry

This is caused by the sort at line 697:

> $CARDS.values.sort.each { |card|

I dunno this can be simply ignored.

David
--- ../wn-for-goldendict.rb	2014-01-28 20:14:28.000000000 +0100
+++ debian/wn-for-goldendict.rb	2014-01-28 20:36:24.000000000 +0100
@@ -293,14 +293,14 @@
     @offset = data[0].to_i
     @lex_filenum = data[1]
     @pos = data[2]
-    @w_cnt = [data[3]].pack('H2')[0]
+    @w_cnt = data[3].hex #[data[3]].pack('H2')[0]
     @words = []
     i = 4
     @lex_ids = []
     @w_cnt.times {
       @words << data[i].gsub(/_/, ' ').gsub(/\s*\((p|a|ip)\)\s*$/, '')
       i += 1
-      @lex_ids << [data[i]].pack('h')[0]
+      @lex_ids << data[i].hex #[data[i]].pack('h')[0]
       i += 1
     }
 
@@ -362,8 +362,8 @@
     if (src_target == "0000")
       return other.words
     else
-      src = [src_target[0, 2]].pack('H2')[0]
-      target = [src_target[2, 2]].pack('H2')[0]
+      src = src_target[0, 2].hex #[src_target[0, 2]].pack('H2')[0]
+      target = src_target[2, 2].hex #[src_target[2, 2]].pack('H2')[0]
       h_src = words[src - 1]
       if (h_src == headword)
         return [other.words[target - 1]]
@@ -374,7 +374,7 @@
   end
   def get_frame_data(headword, frame)
     f_num = frame[0].to_i
-    w_num = [frame[1]].pack('H2')[0]
+    w_num = frame[1].hex #[frame[1]].pack('H2')[0]
     if (w_num == 0)
       return [$frames[f_num]]
     else

Reply via email to