Yields tables from the table file. Tables are parsed into a list of tuples with tokenized entries. Args: table_file: String filename.
(table_file)
| 94 | |
| 95 | |
| 96 | def _table_reader(table_file): |
| 97 | """Yields tables from the table file. |
| 98 | |
| 99 | Tables are parsed into a list of tuples with tokenized entries. |
| 100 | |
| 101 | Args: |
| 102 | table_file: String filename. |
| 103 | """ |
| 104 | with io.open(table_file) as f: |
| 105 | for line in f: |
| 106 | entries = line.lower().split("\t") |
| 107 | # pylint: disable=g-complex-comprehension |
| 108 | table = [ |
| 109 | [member.split() for member in entry.split("|||")] for entry in entries |
| 110 | ] |
| 111 | yield table |
| 112 | |
| 113 | |
| 114 | def cooccur_probability_fn(counts): |