| … | … | @@ -156,7 +156,7 @@ AC_SUBST(HOST_OS) |
| 156 | 156 | |
| 157 | 157 | # ==================================================================== |
| 158 | 158 | # FreeBSD work-around. Apparently, the AX_PTHREAD autoconf macro |
| 159 | # fails to include -lstdthreads in it's results. See bug report | |
| 159 | # fails to include -lstdthreads in its results. See bug report | |
| 160 | 160 | # https://github.com/opencog/link-grammar/issues/1355 |
| 161 | 161 | # So we hack, and explicitly set it here. |
| 162 | 162 | |
| … | … | @@ -495,7 +495,7 @@ AC_SUBST(SQLITE3_CFLAGS) |
| 495 | 495 | # The AtomSpace dictionary backend |
| 496 | 496 | # TODO - use pkg_config for find the libs. |
| 497 | 497 | # TODO - do NOT specify -lpersist-rocks -lpersist-cog here, |
| 498 | # they need to be dynmically loaded instead (for proper | |
| 498 | # they need to be dynamically loaded instead (for proper | |
| 499 | 499 | # initialization of the shared library ctors these contain). |
| 500 | 500 | # Alternately, if they are found, then wrap them with |
| 501 | 501 | # "-Wl,--no-as-needed" |
| … | … | @@ -930,7 +930,7 @@ fi |
| 930 | 930 | |
| 931 | 931 | # =================================================================== |
| 932 | 932 | # swig is needed for compiling the Perl and Python bindings ... |
| 933 | # ... well, actually, no, its not. 'make dist' is currently set up to | |
| 933 | # ... well, actually, no, it's not. 'make dist' is currently set up to | |
| 934 | 934 | # package all of the files generated by swig, so the user does not need |
| 935 | 935 | # to actually install it. However, swig is needed to create the package, |
| 936 | 936 | # and also needed to build from a GitHub pull. |
| … | … | @@ -24,7 +24,7 @@ |
| 24 | 24 | * |
| 25 | 25 | * To make the API simpler, each of these is typedef'ed as a pointer |
| 26 | 26 | * to a data structure. If you're not used to this, some of the code |
| 27 | * may look strange, since its not plain that these types are pointers. | |
| 27 | * may look strange, since it's not plain that these types are pointers. | |
| 28 | 28 | * |
| 29 | 29 | *********************************************************************/ |
| 30 | 30 |
| … | … | @@ -644,7 +644,7 @@ void and_enchain_right(Pool_desc* pool, Exp* &andhead, Exp* &andtail, Exp* item) |
| 644 | 644 | static void report_dict_usage(Dictionary dict) |
| 645 | 645 | { |
| 646 | 646 | // We could also print pool_num_elements_issued() but this is not |
| 647 | // interesting; its slightly less than pool_size(). | |
| 647 | // interesting; it's slightly less than pool_size(). | |
| 648 | 648 | logger().info("LG Dict: %lu entries; %lu Exp_pool elts; %lu MiBytes", |
| 649 | 649 | dict->num_entries, |
| 650 | 650 | pool_size(dict->Exp_pool), |
| … | … | @@ -351,7 +351,7 @@ Dict_node * lookup_section(Dictionary dict, const Handle& germ) |
| 351 | 351 | Exp* andtail = nullptr; |
| 352 | 352 | |
| 353 | 353 | // We really expect dn to not be null here, but ... perhaps it |
| 354 | // is, if its just not been observed before. | |
| 354 | // is, if it's just not been observed before. | |
| 355 | 355 | Exp* eee = nullptr; |
| 356 | 356 | if (dn) |
| 357 | 357 | { |
| … | … | @@ -260,7 +260,7 @@ static Exp* make_pair_exprs(Dictionary dict, const Handle& germ) |
| 260 | 260 | // Get the cached link-name for this pair. |
| 261 | 261 | const std::string& slnk = cached_linkname(local, rawpr); |
| 262 | 262 | |
| 263 | // Direction is easy to determine: its either left or right. | |
| 263 | // Direction is easy to determine: it's either left or right. | |
| 264 | 264 | char cdir = '+'; |
| 265 | 265 | if (rawpr->getOutgoingAtom(1) == germ) cdir = '-'; |
| 266 | 266 | |
| … | … | @@ -446,7 +446,7 @@ static Exp* make_any_conns(Dictionary dict, Pool_desc* pool) |
| 446 | 446 | /// and arity is 3, then this will return `(A+ or B- or C+ or ()) |
| 447 | 447 | /// and (A+ or B- or C+ or ()) and (A+ or B- or C+ or ())`. When |
| 448 | 448 | /// this is exploded into disjuncts, any combination is possible, |
| 449 | /// from size zero to three. That's why its a Cartesian product. | |
| 449 | /// from size zero to three. That's why it's a Cartesian product. | |
| 450 | 450 | /// |
| 451 | 451 | /// FYI, this is a work-around for the lack of a commmutative |
| 452 | 452 | /// multi-product. What we really want to do here is to have the |
| … | … | @@ -497,7 +497,7 @@ Exp* make_cart_pairs(Dictionary dict, const Handle& germ, |
| 497 | 497 | |
| 498 | 498 | Exp* optex = make_optional_node(pool, epr); |
| 499 | 499 | |
| 500 | // If its 1-dimensional, we are done. | |
| 500 | // If it's 1-dimensional, we are done. | |
| 501 | 501 | if (1 == arity) return optex; |
| 502 | 502 | |
| 503 | 503 | Exp* andhead = nullptr; |
| … | … | @@ -151,7 +151,7 @@ struct Dictionary_s |
| 151 | 151 | /* Duplicate words are disallowed in 4.0.dict unless |
| 152 | 152 | * allow_duplicate_words is defined to "true". |
| 153 | 153 | * Duplicate idioms are allowed, unless the "test" parse option |
| 154 | * is set to "disalow-dup-idioms" (listing them for debug). | |
| 154 | * is set to "disallow-dup-idioms" (listing them for debug). | |
| 155 | 155 | * If these variables are 0, they get their allow/disallow values |
| 156 | 156 | * when the first duplicate word/idiom is encountered. |
| 157 | 157 | * 0: not set; 1: allow; -1: disallow */ |
| … | … | @@ -36,7 +36,7 @@ void patch_subscript(char * s) |
| 36 | 36 | if (*de == '\0') return; |
| 37 | 37 | dp = (int) *de; |
| 38 | 38 | |
| 39 | /* If it's followed by a UTF8 char, its NOT a subscript */ | |
| 39 | /* If it's followed by a UTF8 char, it's NOT a subscript */ | |
| 40 | 40 | if (127 < dp || dp < 0) return; |
| 41 | 41 | /* assert ((0 < dp) && (dp <= 127), "Bad dictionary entry!"); */ |
| 42 | 42 | if (isdigit(dp)) return; |
| … | … | @@ -223,7 +223,7 @@ void insert_idiom(Dictionary dict, Dict_node * dn) |
| 223 | 223 | |
| 224 | 224 | /* ---- end of the code alluded to above ---- */ |
| 225 | 225 | |
| 226 | /* now its time to insert them into the dictionary */ | |
| 226 | /* now it's time to insert them into the dictionary */ | |
| 227 | 227 | |
| 228 | 228 | dn_list = start_dn_list; |
| 229 | 229 |
| … | … | @@ -69,7 +69,7 @@ void free_dictionary_root(Dictionary dict) |
| 69 | 69 | /** |
| 70 | 70 | * dict_order_strict - order two dictionary words in proper sort order. |
| 71 | 71 | * Return zero if the strings match, else return in a unique order. |
| 72 | * The order is NOT (locale-dependent) UTF8 sort order; its ordered | |
| 72 | * The order is NOT (locale-dependent) UTF8 sort order; it's ordered | |
| 73 | 73 | * based on numeric values of single bytes. This will uniquely order |
| 74 | 74 | * UTF8 strings, just not in a LANG-dependent (locale-dependent) order. |
| 75 | 75 | * But we don't need/want locale-dependent ordering! |
| … | … | @@ -309,7 +309,7 @@ Dict_node * dict_node_wild_lookup(Dictionary dict, const char *s) |
| 309 | 309 | * The in-RAM representation is NOT a binary tree; instead it is a tree |
| 310 | 310 | * of lists. An Exp node contains a tag: `AND_type`, `OR_type`, etc. |
| 311 | 311 | * The `operand_next` field is used to hold a linked list which is |
| 312 | * joined up with the given Exp type. This is more efficent to traverse, | |
| 312 | * joined up with the given Exp type. This is more efficient to traverse, | |
| 313 | 313 | * and also saves space, as compared to an ordinary binary tree. |
| 314 | 314 | * |
| 315 | 315 | * Example: (A or B or C or D) becomes |
| … | … | @@ -66,7 +66,7 @@ static const char * make_expression(Dictionary dict, |
| 66 | 66 | while (*p && (lg_isspace((unsigned char)*p))) p++; |
| 67 | 67 | if (0 == *p) return p; |
| 68 | 68 | |
| 69 | /* If it's an open paren, assume its the beginning of a new list */ | |
| 69 | /* If it's an open paren, assume it's the beginning of a new list */ | |
| 70 | 70 | if ('(' == *p) |
| 71 | 71 | { |
| 72 | 72 | p = make_expression(dict, ++p, pex); |
| … | … | @@ -66,7 +66,7 @@ struct Table_tracon_s |
| 66 | 66 | * Each element of these arrays points to a vector, called here word-vector, |
| 67 | 67 | * with a size equal to abs(nearest_word - farthest_word) + 1. |
| 68 | 68 | * |
| 69 | * Each element of this vector predicts, in it's status field, whether the | |
| 69 | * Each element of this vector predicts, in its status field, whether the | |
| 70 | 70 | * expected count is zero for a given null-count (when the word it |
| 71 | 71 | * represents is the end word of the range). |
| 72 | 72 | * This prediction is valid for null-counts up to null_count (or for any |
| … | … | @@ -164,7 +164,7 @@ static size_t estimate_tracon_entries(Sentence sent) |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | #if HAVE_THREADS_H && !__EMSCRIPTEN__ |
| 167 | /* Each thread will get it's own version of the `kept_table`. | |
| 167 | /* Each thread will get its own version of the `kept_table`. | |
| 168 | 168 | * If the program creates zillions of threads, then there will |
| 169 | 169 | * be a mem-leak if this table is not released when each thread |
| 170 | 170 | * exits. This code arranges so that `free_tls_table` is called |
| … | … | @@ -851,7 +851,7 @@ static void issue_links_for_choice(Linkage lkg, Parse_choice *pc, |
| 851 | 851 | * |
| 852 | 852 | * How it works: |
| 853 | 853 | * |
| 854 | * Each linkage has the abstact form of a binary tree, with left and | |
| 854 | * Each linkage has the abstract form of a binary tree, with left and | |
| 855 | 855 | * right subtrees. The Parse_set is an encoding for all possible |
| 856 | 856 | * trees. Selecting a linkage is then a matter of selecting tree from |
| 857 | 857 | * out of the parse-set. |
| … | … | @@ -354,7 +354,7 @@ static int linkage_equiv_p(Linkage lpv, Linkage lnx) |
| 354 | 354 | // names were the same. The connector types might still differ, |
| 355 | 355 | // due to intersection. The multi-connector flag might differ. |
| 356 | 356 | // However, neither of these are likely. It is plausible to skip |
| 357 | // this check entirely, its mostly a CPU-time-waster that will | |
| 357 | // this check entirely, it's mostly a CPU-time-waster that will | |
| 358 | 358 | // never find any differences for the almost any situation. |
| 359 | 359 | for (uint32_t li=0; li<lpv->num_links; li++) |
| 360 | 360 | { |
| … | … | @@ -460,7 +460,7 @@ static void deduplicate_linkages(Sentence sent, int linkage_limit) |
| 460 | 460 | !sent->overflowed && (sent->num_linkages_found <= linkage_limit))) |
| 461 | 461 | return; |
| 462 | 462 | |
| 463 | // Deduplicate the valid linkages only; its not worth wasting | |
| 463 | // Deduplicate the valid linkages only; it's not worth wasting | |
| 464 | 464 | // CPU time on the rest. Sorting guarantees that the valid |
| 465 | 465 | // linkages come first. |
| 466 | 466 | uint32_t nl = sent->num_valid_linkages; |
| … | … | @@ -44,7 +44,7 @@ |
| 44 | 44 | #define PRx(x) fprintf(stderr, ""#x) |
| 45 | 45 | #define PR(...) true |
| 46 | 46 | |
| 47 | /* Indicator that this connector cannot be used -- that its "obsolete". */ | |
| 47 | /* Indicator that this connector cannot be used -- that it's "obsolete". */ | |
| 48 | 48 | #define BAD_WORD (MAX_SENTENCE+1) |
| 49 | 49 | |
| 50 | 50 | typedef uint8_t WordIdx_m; /* Storage representation of word index */ |
| … | … | @@ -185,7 +185,7 @@ static inline bool matches_S(connector_table **ct, int w, condesc_t * c) |
| 185 | 185 | * doesn't match anything in the set S. |
| 186 | 186 | * |
| 187 | 187 | * If an OR or AND type expression node has one child, we can replace it |
| 188 | * by it's child. This, of course, is not really necessary, except for | |
| 188 | * by its child. This, of course, is not really necessary, except for | |
| 189 | 189 | * performance. |
| 190 | 190 | */ |
| 191 | 191 |
| … | … | @@ -1444,7 +1444,7 @@ static bool mprefix_split(Sentence sent, Gword *unsplit_word, const char *word) |
| 1444 | 1444 | mprefix_list = AFCLASS(dict->affix_table, AFDICT_MPRE); |
| 1445 | 1445 | mp_strippable = mprefix_list->length; |
| 1446 | 1446 | if (0 == mp_strippable) return false; |
| 1447 | /* The mprefix list is revered-sorted according to prefix length. | |
| 1447 | /* The mprefix list is reversed-sorted according to prefix length. | |
| 1448 | 1448 | * The code here depends on that. */ |
| 1449 | 1449 | mprefix = mprefix_list->string; |
| 1450 | 1450 | |
| … | … | @@ -1539,11 +1539,11 @@ static bool mprefix_split(Sentence sent, Gword *unsplit_word, const char *word) |
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | /* Return true if the word might be capitalized by convention: |
| 1542 | * -- if its the first word of a sentence | |
| 1543 | * -- if its the first word following a colon, a period, a question mark, | |
| 1542 | * -- if it's the first word of a sentence | |
| 1543 | * -- if it's the first word following a colon, a period, a question mark, | |
| 1544 | 1544 | * or any bullet (For example: VII. Ancient Rome) |
| 1545 | * -- if its the first word following an ellipsis | |
| 1546 | * -- if its the first word of a quote | |
| 1545 | * -- if it's the first word following an ellipsis | |
| 1546 | * -- if it's the first word of a quote | |
| 1547 | 1547 | * |
| 1548 | 1548 | * XXX FIXME: These rules are rather English-centric. Someone should |
| 1549 | 1549 | * do something about this someday. |
| … | … | @@ -2270,7 +2270,7 @@ static void issue_r_stripped(Sentence sent, |
| 2270 | 2270 | if (NULL != r_stripped[1][i]) |
| 2271 | 2271 | { |
| 2272 | 2272 | /* We are going to issue a subscripted word which is not a |
| 2273 | * substring of it's unsplit_word. For now, the token position | |
| 2273 | * substring of its unsplit_word. For now, the token position | |
| 2274 | 2274 | * computation code needs an indication for that. */ |
| 2275 | 2275 | replabel = strdupa(label); |
| 2276 | 2276 | replabel[0] = REPLACEMENT_MARK[0]; |
| … | … | @@ -64,7 +64,7 @@ static tid_hash_t hash_connectors(const Connector *c, unsigned int shallow) |
| 64 | 64 | * cache/swap trashing if the table temporary grows very big. However, it |
| 65 | 65 | * had a bug, and it is not clear when to shrink the table - shrinking it |
| 66 | 66 | * unnecessarily can cause an overhead of a table growth. Keep for |
| 67 | * possible reimlementation of a similar idea. | |
| 67 | * possible reimplementation of a similar idea. | |
| 68 | 68 | */ |
| 69 | 69 | static unsigned int find_prime_for(size_t count) |
| 70 | 70 | { |
| … | … | @@ -49,7 +49,7 @@ static wchar_t * prompt(EditLine *el) |
| 49 | 49 | return wc_prompt; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | // lg_readline()is called via a chain of functions: | |
| 52 | // lg_readline() is called via a chain of functions: | |
| 53 | 53 | // fget_input_string -> get_line -> get_terminal_line -> lg_readline. |
| 54 | 54 | // To avoid changing all of them, this variable is static for now. |
| 55 | 55 | // FIXME: Move the call of find_history_filepath() to lg_readline(), and |