File: infosort.c

package info (click to toggle)
anthy 6300d-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,400 kB
  • ctags: 2,270
  • sloc: ansic: 17,009; sh: 13,554; lisp: 1,039; makefile: 252; ruby: 212; perl: 10
file content (32 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * ʸι¤metaword򥽡Ȥ
 *
 * ʸФʣι¤θ򥽡Ȥ
 *
 */
#include <stdlib.h>

#include <segment.h>
#include <ordering.h>
#include <splitter.h>
#include "sorter.h"


static int
metaword_compare_func(const void *p1, const void *p2)
{
  const struct meta_word * const *s1 = p1;
  const struct meta_word * const *s2 = p2;
  return (*s2)->score - (*s1)->score;
}

void
anthy_sort_metaword(struct segment_list *seg)
{
  int i;
  for (i = 0; i < seg->nr_segments; i++) {
    struct seg_ent *se = anthy_get_nth_segment(seg, i);
    qsort(se->mw_array, se->nr_metaword, sizeof(struct meta_word *),
	  metaword_compare_func);
  }
}