File size: 9,890 Bytes
b0213f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import json
import os

import utils_mewslix


def load_jsonl(path):
    data = list()
    with open(path) as f:
        for line in f:
            obj = json.loads(line)
            data.append(obj)
    print('load', len(data), 'from', path)
    return data

def dump_jsonl(path, data):
    with open(path, 'w') as f:
        for obj in data:
            line = json.dumps(obj, ensure_ascii=False)
            f.write(line + '\n')
    print('dump', len(data), 'to', path)
    return data


for split in ('dev', 'train'):
    data = load_jsonl(f'raw/wikipedia_pairs-{split}.jsonl')
    processed = list()
    for example in data:
        ins = utils_mewslix.MentionEntityPair.from_json(example)
        mention = utils_mewslix.preprocess_mention(ins.contextual_mention)
        entity = utils_mewslix.preprocess_entity_description(ins.entity)
        processed.append({'mention': mention, 'entity': entity})
    os.makedirs('wikipedia_pairs', exist_ok=True)
    dump_jsonl(f'wikipedia_pairs/{split}.jsonl', processed)
print(0)


from collections import defaultdict

for split in ('dev', 'test'):
    data = load_jsonl(f'raw/wikinews_mentions-{split}.jsonl')
    processed = defaultdict(list)
    for example in data:
        doc_mentions = utils_mewslix.ContextualMentions.from_json(example)
        mentions = list(doc_mentions.unnest_to_single_mention_per_context())
        assert len(mentions) == len(set(m.mention.example_id for m in mentions))
        for m in mentions:
            text = utils_mewslix.preprocess_mention(m)
            processed[m.context.language].append({
                'mention': text, 'example_id': m.mention.example_id, 'entity_id': m.mention.entity_id
            })
    for k, v in processed.items():
        os.makedirs(k, exist_ok=True)
        dump_jsonl(f'{k}/{split}.jsonl', v)
print(0)


data = load_jsonl('raw/candidate_set_entities.jsonl')
processed = list()
for example in data:
    entity = utils_mewslix.Entity.from_json(example)
    description = utils_mewslix.preprocess_entity_description(entity)
    processed.append({'entity_id': entity.entity_id, 'description': description})
dump_jsonl('candidate_entities.jsonl', processed)
print(0)

"""
load 14051 from raw/wikipedia_pairs-dev.jsonl
Applied marker escaping for example_id 65a219eb42f99cbf6366a7a2db2804e6: converges: Take a sequence of rational numbers (xₖ) with the property that (xₖ) { converges } , with respect to the Euclidean topology, towards x as k tends towards infinity.
Applied marker escaping for example_id 117d2387a75732dd886d4b87f7c8df3f: Punjabi Kabaddi: { Punjabi Kabaddi } , Cricket and Volleyball (Volleyball variations#Shooting volleyball) are the three most popular sports played in Nathumajra.
Applied marker escaping for example_id c9eebe82f772bc998164d800913fe9d1: Humboldt Prize: Andronov Prize of the Soviet Academy of Science, { Humboldt Prize } Docteur (honoris causa) of the University of Rouen in France, 1996.
dump 14051 to wikipedia_pairs/dev.jsonl
load 167719 from raw/wikipedia_pairs-train.jsonl
Applied marker escaping for example_id 085742b6c52b79cc1ec0f99abaec73b3: singleton: The rational sequence topology is given by defining both the whole set R and the empty set ∅ to be open, defining each rational number { singleton } to be open, and using as a basis for the irrational number x, the sets  U_n(x) := \( x_k : n \le k < \infty \) \cup \(x\) .
Applied marker escaping for example_id e43ad636ff84f4df09e6a6db4b6b5934: natural number: For example, let G be the free group in two generators, x and y (which is clearly finitely generated, since G = ⟨(x,y)⟩), and let S be the subset consisting of all elements of G of the form yⁿxy⁻ⁿ for n a { natural number } .
Applied marker escaping for example_id e841dabaadf98df0c54886a3bc214e65: group of units: The { group of units } U(Z₉) is the group of all integers relatively prime to 9 under multiplication mod 9 (U₉ = (1, 2, 4, 5, 7, 8)).
Applied marker escaping for example_id 95b9c80742ca084b130bf4d1ab1ed12d: subsumption architecture: Suppose the \mathbb(A) has a { subsumption architecture } ; each component of this architecture can be then represented as a formal grammar too and the final behavior of the agent is then described by this system of grammars.
Applied marker escaping for example_id c871de06fd88557a53605197ecc3b1ad: variables: The transformation transforms the equations of axisymmetric boundary layer with external velocity U in terms of original { variables } x,y,u,v into the equations of plane boundary layer with external velocity \bar(U) in terms of the new variables \bar(x),\bar(y),\bar(u),\bar(v).
Applied marker escaping for example_id 37901554006b02b435fe07f02a7d2f42: formal language: The set of possible behaviors of \mathbb(A) can then be described as { formal language } \mathbb(L_A)=\((f^mt^nf^r)^+:1\leq m\leq k; 1\leq n\leq \ell;1\leq r\leq k\), where ƒ can be done maximally k times and t can be done maximally ℓ times considering the dimensions of the table.
Applied marker escaping for example_id 1724238f8b345db438bc8f727b122499: integers: Similarly, while (1) is a group generator of the set of relative { integers } , (1) is not a monoid generator of the set of relative integers.
Applied marker escaping for example_id bc8093f8a1203a97620268135de3d9cd: basis: The rational sequence topology is given by defining both the whole set R and the empty set ∅ to be open, defining each rational number singleton to be open, and using as a { basis } for the irrational number x, the sets  U_n(x) := \( x_k : n \le k < \infty \) \cup \(x\) .
Applied marker escaping for example_id 3ec38d65e84b1114ea9a0623373c1e48: Euclidean topology: Take a sequence of rational numbers (xₖ) with the property that (xₖ) converges, with respect to the { Euclidean topology } , towards x as k tends towards infinity.
Applied marker escaping for example_id b63ae14dd4d3eb15eaf76e10fbc9b8fd: Volleyball: Punjabi Kabaddi, Cricket and { Volleyball } (Volleyball variations#Shooting volleyball) are the three most popular sports played in Nathumajra.
Applied marker escaping for example_id ebce8204d39acbe44844cee5acd3e71c: gcd: For example, if p and q are integers with { gcd } (p, q) = 1, then (p, q) also generates the group of integers under addition by Bézout's identity.
Applied marker escaping for example_id ffb31062390d77cf8891fe9aa9727fbf: Bézout's identity: For example, if p and q are integers with gcd(p, q) = 1, then (p, q) also generates the group of integers under addition by { Bézout's identity } .
Applied marker escaping for example_id e92e38d3229a7d21cfdaeaeac8178e0e: relatively prime: The group of units U(Z₉) is the group of all integers { relatively prime } to 9 under multiplication mod 9 (U₉ = (1, 2, 4, 5, 7, 8)).
Applied marker escaping for example_id ba03705f1c85e9d484936537de12a2bf: free group: For example, let G be the { free group } in two generators, x and y (which is clearly finitely generated, since G = ⟨(x,y)⟩), and let S be the subset consisting of all elements of G of the form yⁿxy⁻ⁿ for n a natural number.
Applied marker escaping for example_id b06d8979dde2a54ae575db9218ed32e6: dihedral group: The { dihedral group } of order n is generated by the set (r, s), where r represents rotation by π/n and s is any reflection about a line of symmetry.
Applied marker escaping for example_id b145017f6ad3921a18c52eacbe30e765: natural numbers: The set  S is said to be a semigroup generating set of G if each element of G is a finite sum of elements of S. Similarly, a set S is said to be a monoid generating set of G if each non-zero element of G is a finite sum of elements of S. For example (1) is a monoid generator of the set of non-negative { natural numbers } .
Applied marker escaping for example_id 88a8f3a822dd6d73264ed45f5f86f467: coprime: The two-element subset (3, 5) is a generating set, since (−5) + 3 + 3 = 1 (in fact, any pair of { coprime } numbers is, as a consequence of Bézout's identity).
Applied marker escaping for example_id 756f9388cc9acffd4e22882c132da6f4: Coxeter group: This makes the tetrahedron-triangle duoprism prism, (3,3)×(3)×(), Seen in a configuration matrix, the element counts can be derived by mirror removal and ratios of { Coxeter group } orders.
Applied marker escaping for example_id f5ceb367eb87e2648a0e1fdd573b7740: sequence: Take a { sequence } of rational numbers (xₖ) with the property that (xₖ) converges, with respect to the Euclidean topology, towards x as k tends towards infinity.
Applied marker escaping for example_id f373938282a4d76ad3ca7566ca253c48: configuration matrix: This makes the tetrahedron-triangle duoprism prism, (3,3)×(3)×(), Seen in a { configuration matrix } , the element counts can be derived by mirror removal and ratios of Coxeter group orders.
Applied marker escaping for example_id 33431733fb6ea83a79a31d8fa2ea38a7: Bézout's identity: The two-element subset (3, 5) is a generating set, since (−5) + 3 + 3 = 1 (in fact, any pair of coprime numbers is, as a consequence of { Bézout's identity } ).
dump 167719 to wikipedia_pairs/train.jsonl
0
load 2618 from raw/wikinews_mentions-dev.jsonl
dump 318 to ar/dev.jsonl
dump 326 to de/dev.jsonl
dump 316 to en/dev.jsonl
dump 311 to es/dev.jsonl
dump 72 to fa/dev.jsonl
dump 310 to ja/dev.jsonl
dump 304 to pl/dev.jsonl
dump 145 to ro/dev.jsonl
dump 312 to ta/dev.jsonl
dump 262 to tr/dev.jsonl
dump 315 to uk/dev.jsonl
load 9608 from raw/wikinews_mentions-test.jsonl
dump 1501 to ar/test.jsonl
dump 1551 to de/test.jsonl
dump 1490 to en/test.jsonl
dump 1552 to es/test.jsonl
dump 458 to fa/test.jsonl
dump 1519 to ja/test.jsonl
dump 1562 to pl/test.jsonl
dump 672 to ro/test.jsonl
dump 1567 to ta/test.jsonl
dump 1215 to tr/test.jsonl
dump 1537 to uk/test.jsonl
0
load 1003893 from raw/candidate_set_entities.jsonl
dump 1003893 to candidate_entities.jsonl
0
"""