Skip to content

Commit 76c6b04

Browse files
committed
Merge branch 'feat/new-version' into main
2 parents 1b70e83 + 1ba2b00 commit 76c6b04

File tree

5 files changed

+6887
-19
lines changed

5 files changed

+6887
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ selected entities (like Xi Jingping or ISIS). Go straight to the
66
[website](https://ndabap.github.io/entityscrape/index.html)!
77

88
The Go package [assocentity](https://github.com/ndabAP/assocentity) was
9-
used for creating this experiment. You can create new ones with updating the
9+
used for creating this experiment. You can create new ones by updating the
1010
`source/entities.txt` file and run the CLI with the provided Visual Studio Code
1111
debug configuration.
1212

docs/assets/index.4a525f31.js

Lines changed: 6857 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<link rel="icon" href="/entityscrape/favicon.ico">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
88
<title>entityscrape</title>
9-
<script type="module" crossorigin src="/entityscrape/assets/index.1ffcbe9f.js"></script>
9+
<script type="module" crossorigin src="/entityscrape/assets/index.4a525f31.js"></script>
1010
<link rel="stylesheet" href="/entityscrape/assets/index.de220886.css">
1111
</head>
1212

main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,14 @@ func scrape(texts, entities []string, tokenizer tokenize.Tokenizer) error {
159159
continue
160160
}
161161

162+
// Ignore unusual missmatches
163+
poS, ok := tokenize.PoSMapStr[meanVal.tok.PoS]
164+
if !ok {
165+
continue
166+
}
162167
topMeanVals = append(topMeanVals, topMeanVal{
163168
Dist: meanVal.dist,
164-
PoS: tokenize.PoSMapStr[meanVal.tok.PoS],
169+
PoS: poS,
165170
Text: meanVal.tok.Text,
166171
})
167172

@@ -211,7 +216,12 @@ func readArticles(path string) (articles [][]string, err error) {
211216
}
212217

213218
func accumTexts(articles [][]string) (texts []string) {
214-
// For [[ID1, DATE1, LINK1, TITLE1, SUBTILE1, TEXT1], [ID2, DATE2, LINK2, TITLE2, SUBTILE2, TEXT2], ...]
219+
// For
220+
// [
221+
// [ID1, DATE1, LINK1, TITLE1, SUBTILE1, TEXT1],
222+
// [ID2, DATE2, LINK2, TITLE2, SUBTILE2, TEXT2],
223+
// ...
224+
// ]
215225
for _, article := range articles[1:] { // Remove CSV header
216226
// Or: text := article[5]
217227
for idx, text := range article {

web/src/App.vue

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p>
1111
The Go package
1212
<a href="https://github.com/ndabAP/assocentity">assocentity</a> was used
13-
for creating this experiment. You can create new ones with updating the
13+
for creating this experiment. You can create new ones by updating the
1414
<code>source/entities.txt</code> file and run the CLI with the provided
1515
Visual Studio Code debug configuration. The experiments source code can be
1616
found at
@@ -40,6 +40,7 @@
4040
display: false,
4141
},
4242
},
43+
4344
y: {
4445
ticks: {
4546
font: {
@@ -133,41 +134,41 @@ export default defineComponent({
133134
});
134135
}
135136
136-
let meanN = [];
137+
let mean = [];
137138
const fetchEntity = async (entity) => {
138139
entity = entity.toLowerCase().replace(/ /g, "+");
139140
const response = await fetch(`${import.meta.env.BASE_URL}${entity}.json`);
140-
meanN = await response.json();
141+
mean = await response.json();
141142
};
142143
143-
const filterPosMeanN = () => {
144-
posMeanN.splice(0);
145-
meanN.forEach((meanN) => {
144+
const filterPosMean = () => {
145+
posMean.splice(0);
146+
mean.forEach((meanN) => {
146147
if (selectedPos.value === meanN.pos) {
147-
posMeanN.push(meanN);
148+
posMean.push(meanN);
148149
}
149150
});
150151
};
151152
152-
let posMeanN = reactive([]);
153+
let posMean = reactive([]);
153154
const chartData = computed(() => {
154-
if (posMeanN.length === 0) {
155+
if (posMean.length === 0) {
155156
return {
156157
labels: [],
157158
datasets: [],
158159
};
159160
}
160161
161162
return {
162-
labels: posMeanN.map((meanN) => {
163-
return meanN.text;
163+
labels: posMean.map((mean) => {
164+
return mean.text;
164165
}),
165166
166167
datasets: [
167168
{
168169
label: "Mean distances",
169-
data: posMeanN.map((meanN) => {
170-
return meanN.distance;
170+
data: posMean.map((mean) => {
171+
return mean.distance;
171172
}),
172173
},
173174
],
@@ -178,13 +179,13 @@ export default defineComponent({
178179
await fetchEntity(selectedEntity.value);
179180
180181
watch(selectedPos, () => {
181-
filterPosMeanN();
182+
filterPosMean();
182183
});
183184
selectedPos.value = "ADJ";
184185
185186
watch(selectedEntity, async (entity) => {
186187
await fetchEntity(entity);
187-
filterPosMeanN();
188+
filterPosMean();
188189
});
189190
});
190191

0 commit comments

Comments
 (0)