update for r field
This commit is contained in:
parent
68c1a70ecc
commit
ab865b9fe2
|
@ -9,7 +9,7 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lingdocs/inflect": "5.1.10",
|
"@lingdocs/inflect": "5.2.1",
|
||||||
"base64url": "^3.0.1",
|
"base64url": "^3.0.1",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"connect-redis": "^6.0.0",
|
"connect-redis": "^6.0.0",
|
||||||
|
@ -124,9 +124,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lingdocs/inflect": {
|
"node_modules/@lingdocs/inflect": {
|
||||||
"version": "5.1.10",
|
"version": "5.2.1",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz",
|
||||||
"integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==",
|
"integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
|
@ -2741,9 +2741,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@lingdocs/inflect": {
|
"@lingdocs/inflect": {
|
||||||
"version": "5.1.10",
|
"version": "5.2.1",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz",
|
||||||
"integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==",
|
"integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
"rambda": "^7.3.0"
|
"rambda": "^7.3.0"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lingdocs/inflect": "5.1.10",
|
"@lingdocs/inflect": "5.2.1",
|
||||||
"base64url": "^3.0.1",
|
"base64url": "^3.0.1",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"connect-redis": "^6.0.0",
|
"connect-redis": "^6.0.0",
|
||||||
|
|
|
@ -45,10 +45,10 @@
|
||||||
"@jridgewell/resolve-uri" "^3.0.3"
|
"@jridgewell/resolve-uri" "^3.0.3"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||||
|
|
||||||
"@lingdocs/inflect@5.1.10":
|
"@lingdocs/inflect@5.2.1":
|
||||||
"integrity" "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA=="
|
"integrity" "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog=="
|
||||||
"resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz"
|
"resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz"
|
||||||
"version" "5.1.10"
|
"version" "5.2.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
"pbf" "^3.2.1"
|
"pbf" "^3.2.1"
|
||||||
"rambda" "^7.3.0"
|
"rambda" "^7.3.0"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"name": "functions",
|
"name": "functions",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.1",
|
||||||
"@lingdocs/inflect": "5.1.10",
|
"@lingdocs/inflect": "5.2.1",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/google-spreadsheet": "^3.0.2",
|
"@types/google-spreadsheet": "^3.0.2",
|
||||||
"@types/react": "^18.0.21",
|
"@types/react": "^18.0.21",
|
||||||
|
@ -391,9 +391,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lingdocs/inflect": {
|
"node_modules/@lingdocs/inflect": {
|
||||||
"version": "5.1.10",
|
"version": "5.2.1",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz",
|
||||||
"integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==",
|
"integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
|
@ -3499,9 +3499,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@lingdocs/inflect": {
|
"@lingdocs/inflect": {
|
||||||
"version": "5.1.10",
|
"version": "5.2.1",
|
||||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.1.10.tgz",
|
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.2.1.tgz",
|
||||||
"integrity": "sha512-LPJqXSnb2zLWLfMXMTCs/1NOGYQnzPHbKu5h/SdvFYobCxnk2tgngtSWcCmeqYbNXKqQvbDwqmseLlcnUZKysA==",
|
"integrity": "sha512-A2Is03lIx8od0JfnHjAbreNeI1jsoRARRXnNhqaJ+Hw7DMPMXEkOlpZnY/luvTcUA7/E5FHKEEAtBOng//zcog==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"pbf": "^3.2.1",
|
"pbf": "^3.2.1",
|
||||||
"rambda": "^7.3.0"
|
"rambda": "^7.3.0"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"main": "lib/functions/src/index.js",
|
"main": "lib/functions/src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/storage": "^5.8.1",
|
"@google-cloud/storage": "^5.8.1",
|
||||||
"@lingdocs/inflect": "5.1.10",
|
"@lingdocs/inflect": "5.2.1",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/google-spreadsheet": "^3.0.2",
|
"@types/google-spreadsheet": "^3.0.2",
|
||||||
"@types/react": "^18.0.21",
|
"@types/react": "^18.0.21",
|
||||||
|
|
|
@ -26,8 +26,8 @@ const title = "LingDocs Pashto Dictionary"
|
||||||
const license = "Copyright © 2021 lingdocs.com All Rights Reserved - Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License - https://creativecommons.org/licenses/by-nc-sa/4.0/";
|
const license = "Copyright © 2021 lingdocs.com All Rights Reserved - Licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License - https://creativecommons.org/licenses/by-nc-sa/4.0/";
|
||||||
const bucketName = "lingdocs";
|
const bucketName = "lingdocs";
|
||||||
const baseUrl = `https://storage.googleapis.com/${bucketName}/`;
|
const baseUrl = `https://storage.googleapis.com/${bucketName}/`;
|
||||||
const dictionaryFilename = "dictionary";
|
const dictionaryFilename = "dict";
|
||||||
const dictionaryInfoFilename = "dictionary-info";
|
const dictionaryInfoFilename = "dict-info";
|
||||||
const hunspellAffFileFilename = "ps_AFF.aff";
|
const hunspellAffFileFilename = "ps_AFF.aff";
|
||||||
const hunspellDicFileFilename = "ps_AFF.dic";
|
const hunspellDicFileFilename = "ps_AFF.dic";
|
||||||
const url = `${baseUrl}${dictionaryFilename}`;
|
const url = `${baseUrl}${dictionaryFilename}`;
|
||||||
|
@ -84,7 +84,10 @@ async function doHunspell(entries: T.DictionaryEntry[]) {
|
||||||
* @returns
|
* @returns
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
||||||
|
let rows: GoogleSpreadsheetRow[] = []
|
||||||
|
async function getRows() {
|
||||||
const doc = new GoogleSpreadsheet(
|
const doc = new GoogleSpreadsheet(
|
||||||
functions.config().sheet.id,
|
functions.config().sheet.id,
|
||||||
);
|
);
|
||||||
|
@ -94,19 +97,17 @@ async function getRawEntries(): Promise<T.DictionaryEntry[]> {
|
||||||
});
|
});
|
||||||
await doc.loadInfo();
|
await doc.loadInfo();
|
||||||
const sheet = doc.sheetsByIndex[0];
|
const sheet = doc.sheetsByIndex[0];
|
||||||
const rows = await sheet.getRows();
|
rows = await sheet.getRows();
|
||||||
|
rows.sort((a, b) => a.ts > b.ts ? -1 : a.ts < b.ts ? 1 : 0);
|
||||||
|
}
|
||||||
|
getRows()
|
||||||
async function deleteRow(i: number) {
|
async function deleteRow(i: number) {
|
||||||
console.log("WILL DELETE ROW", rows[i].p, rows[i].ts, rows[i].f);
|
console.log("WILL DELETE ROW", rows[i].p, rows[i].ts, rows[i].f);
|
||||||
await rows[i].delete();
|
await rows[i].delete();
|
||||||
}
|
}
|
||||||
return await makeEntries(rows, deleteRow);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function makeEntries(rows: GoogleSpreadsheetRow[], deleteRow: (i: number) => Promise<void>): Promise<T.DictionaryEntry[]> {
|
|
||||||
const entries: T.DictionaryEntry[] = [];
|
const entries: T.DictionaryEntry[] = [];
|
||||||
let sheetIndex = 0;
|
let sheetIndex = 0;
|
||||||
// get the rows in order of ts for easy detection of duplicate entries
|
// get the rows in order of ts for easy detection of duplicate entries
|
||||||
rows.sort((a, b) => a.ts > b.ts ? -1 : a.ts < b.ts ? 1 : 0);
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
function sameEntry(a: any, b: any): boolean {
|
function sameEntry(a: any, b: any): boolean {
|
||||||
return a.p === b.p && a.f === b.f && a.e === b.e;
|
return a.p === b.p && a.f === b.f && a.e === b.e;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||||
"@lingdocs/ps-react": "5.1.10",
|
"@lingdocs/ps-react": "5.2.1",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
|
|
@ -2349,10 +2349,10 @@
|
||||||
"@jridgewell/resolve-uri" "^3.0.3"
|
"@jridgewell/resolve-uri" "^3.0.3"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||||
|
|
||||||
"@lingdocs/ps-react@5.1.10":
|
"@lingdocs/ps-react@5.2.1":
|
||||||
version "5.1.10"
|
version "5.2.1"
|
||||||
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.1.10.tgz#155646c436c7dc2644c60815cef6b914ba7fef69"
|
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.2.1.tgz#e483ced9d12a1913564831f8b37fdb843b912e80"
|
||||||
integrity sha512-3PtfEZBmNCa6ptlWezLXpHrngcRmPc8QKguGiXI48TnVxSvAaSH63FTwRQJIDznYasq3bnDSH/7Sta8SX8vvBA==
|
integrity sha512-2gG2GVNISgjgiyOjyt1rjCPeJ+Bd+FWKZMPXHV98KFSWuuUEX5Jhf8K2FXzv0CGdTOviI++V1O07y86iCSlaXA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@formkit/auto-animate" "^1.0.0-beta.3"
|
"@formkit/auto-animate" "^1.0.0-beta.3"
|
||||||
classnames "^2.2.6"
|
classnames "^2.2.6"
|
||||||
|
|
Loading…
Reference in New Issue