mirror of
https://github.com/minimo-io/appticles.git
synced 2025-06-23 16:05:29 +00:00
Merge function finished! v0.0.2-6
This commit is contained in:
parent
bfe6fa3b59
commit
bdf7bd93d4
@ -107,13 +107,37 @@ main(List<String> args) async {
|
||||
String input1 = await File(parserResults["input1"]).readAsString();
|
||||
String input2 = await File(parserResults["input2"]).readAsString();
|
||||
|
||||
var json1 = jsonDecode(input1);
|
||||
List json1 = jsonDecode(input1);
|
||||
List json2 = jsonDecode(input2);
|
||||
print("Json 1 total word wount:" + json1.length.toString());
|
||||
print("Json 2 total word wount:" + json2.length.toString());
|
||||
|
||||
print(json1);
|
||||
int sameWordsCount = 0;
|
||||
List<Map<String, dynamic>> finalList = [];
|
||||
for (var i = 0; i < json1.length; i++) {
|
||||
bool isDuplicated = false;
|
||||
// check on json2 strings
|
||||
for (var ii = 0; ii < json2.length; ii++) {
|
||||
if (json1[i]["t"] == json2[ii]["t"]) {
|
||||
// if exists in both remove from the second file before merge
|
||||
json2.remove(json2[ii]);
|
||||
|
||||
// File(parserResults["input1"]).readAsString().then((String contents) {
|
||||
sameWordsCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
finalList = [...json1, ...json2];
|
||||
// if (isDuplicated == true) {
|
||||
// finalList.add(json1[i]);
|
||||
// print(json1[i]["t"]);
|
||||
// }
|
||||
}
|
||||
|
||||
// });
|
||||
print("Ché, there is a total of $sameWordsCount duplicated words.");
|
||||
print("Total words for new file: " + (finalList.length.toString()));
|
||||
// return map['users'];
|
||||
|
||||
saveFile(json.encode(finalList), parserResults["output"]);
|
||||
}
|
||||
// last dicc from folkloretradiciones.com.ar
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
3137
mo-lunfardo/data/lunfardo-dict-es.json
Normal file
3137
mo-lunfardo/data/lunfardo-dict-es.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -29,8 +29,8 @@ const App = Vue.createApp({
|
||||
|
||||
async mounted(){
|
||||
// const res = await fetch("https://cdn.jsdelivr.net/gh/minimo-io/appticles@v0.0.2-6/mo-lunfardo/data/lunfardo-dict-es.json");
|
||||
// const res = await fetch("tools/dicc.json");
|
||||
const res = await fetch("data/lunfardo-dict-es.json");
|
||||
//const res = await fetch("data/dicc-merged.json");
|
||||
const res = await fetch("dart_tools/data/lunfardo-dict-es.json");
|
||||
this.wordsJson = await res.json();
|
||||
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user