Textonyms: Difference between revisions
Content deleted Content added
Added C solution |
m Minor edit to C code |
||
Line 241:
int compare_by_text_length(const void* p1, const void* p2) {
const textonym_t* t1 =
const textonym_t* t2 =
if (t1->length > t2->length)
return -1;
Line 251:
int compare_by_word_count(const void* p1, const void* p2) {
const textonym_t* t1 =
const textonym_t* t2 =
if (t1->words->len > t2->words->len)
return -1;
Line 290:
void free_strings(gpointer ptr) {
g_ptr_array_free(
}
Line 304:
GString* text = g_string_sized_new(64);
guint count = 0;
guint textonyms = 0;▼
while (get_line(in, word)) {
if (!text_string(word, text))
Line 326 ⟶ 325:
GPtrArray* v = (GPtrArray*)value;
if (v->len > 1) {
textonym_t textonym;
textonym.text =
textonym.length = strlen(key);
textonym.words = v;
Line 339 ⟶ 337:
guint size = g_hash_table_size(ht);
printf("They require %u digit combinations to represent them.\n", size);
printf("%u digit combinations represent Textonyms.\n", textonyms);
|