@@ -16,12 +16,6 @@ type Handle struct {
1616 db []* cluster
1717}
1818
19- type index struct {
20- pos PartOfSpeech
21- lemma string
22- sense uint8
23- }
24-
2519// The results of a search against the wordnet database
2620type Lookup struct {
2721 word string // the word the user searched for
@@ -158,7 +152,7 @@ func (w *Lookup) Gloss() string {
158152
159153func (w * Lookup ) DumpStr () string {
160154 s := fmt .Sprintf ("Word: %s\n " , w .String ())
161- s += fmt . Sprintf ( "Synonyms: " )
155+ s += "Synonyms: "
162156 words := []string {}
163157 for _ , w := range w .cluster .words {
164158 words = append (words , w .word )
@@ -240,8 +234,8 @@ func New(dir string) (*Handle, error) {
240234
241235 err = inPlaceReadLineFromPath (filename , func (data []byte , line , offset int64 ) error {
242236 cnt ++
243- if p , err := parseLine (data , line , offset ); err != nil {
244- return fmt .Errorf ("%s:%d: %s " , err )
237+ if p , err := parseLine (data , line ); err != nil {
238+ return fmt .Errorf ("%s" , err )
245239 } else if p != nil {
246240 // first, let's identify the cluster
247241 index := ix {p .byteOffset , p .pos }
@@ -299,15 +293,15 @@ func New(dir string) (*Handle, error) {
299293 }
300294 for _ , c := range byOffset {
301295 if len (c .words ) == 0 {
302- return nil , fmt .Errorf ("ERROR, internal consistency error -> cluster without words %v\n " , c )
296+ return nil , fmt .Errorf ("ERROR, internal consistency error -> cluster without words %v" , c )
303297 }
304298 // add to the global slice of synsets (supports iteration)
305299 h .db = append (h .db , c )
306300
307301 // now index all the strings
308302 for _ , w := range c .words {
309303 key := normalize (w .word )
310- v , _ := h .index [key ]
304+ v := h .index [key ]
311305 v = append (v , c )
312306 h .index [key ] = v
313307 }
@@ -331,7 +325,7 @@ func (h *Handle) Lookup(crit Criteria) ([]Lookup, error) {
331325 return nil , fmt .Errorf ("empty string passed as criteria to lookup" )
332326 }
333327 searchStr := normalize (crit .Matching )
334- clusters , _ := h .index [searchStr ]
328+ clusters := h .index [searchStr ]
335329 found := []Lookup {}
336330 for _ , c := range clusters {
337331 if len (crit .POS ) > 0 {
0 commit comments