diff options
author | James Maa <jmaa@berkeley.edu> | 2024-06-24 09:56:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 16:56:02 +0000 |
commit | cfa33c8f5d77b2365abc3715c31d18f52135897b (patch) | |
tree | 7d9d7037f29e86677f5cd0d089866f457b2149b4 /benches | |
parent | b584c5440721fa7399564ced57f134fd5333d20c (diff) |
More Spanish transforms (#1100)
* Preterite and spanish bench
* More spanish forms
* Rename
Diffstat (limited to 'benches')
-rw-r--r-- | benches/japanese-language-transformer.bench.js (renamed from benches/language-transformer.bench.js) | 6 | ||||
-rw-r--r-- | benches/spanish-language-transformer.bench.js | 140 |
2 files changed, 143 insertions, 3 deletions
diff --git a/benches/language-transformer.bench.js b/benches/japanese-language-transformer.bench.js index d06fd963..7f4922c2 100644 --- a/benches/language-transformer.bench.js +++ b/benches/japanese-language-transformer.bench.js @@ -22,7 +22,7 @@ import {LanguageTransformer} from '../ext/js/language/language-transformer.js'; const languageTransformer = new LanguageTransformer(); languageTransformer.addDescriptor(japaneseTransforms); -describe('language transformer', () => { +describe('japanese language transformer', () => { describe('basic tests', () => { const adjectiveInflections = [ '愛しい', @@ -199,14 +199,14 @@ describe('language transformer', () => { ]; const basicTransformations = [...adjectiveInflections, ...verbInflections, ...inflectionCombinations]; - bench(`transformations (n=${basicTransformations.length})`, () => { + bench(`japanese transformations (n=${basicTransformations.length})`, () => { for (const transform of basicTransformations) { languageTransformer.transform(transform); } }); const transformationsFull = [...basicTransformations, ...kuruInflections, ...suruInflections, ...kansaibenInflections]; - bench(`transformations-full (n=${transformationsFull.length})`, () => { + bench(`japanese transformations-full (n=${transformationsFull.length})`, () => { for (const transform of transformationsFull) { languageTransformer.transform(transform); } diff --git a/benches/spanish-language-transformer.bench.js b/benches/spanish-language-transformer.bench.js new file mode 100644 index 00000000..8dc60ceb --- /dev/null +++ b/benches/spanish-language-transformer.bench.js @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2023-2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +import {bench, describe} from 'vitest'; +import {spanishTransforms} from '../ext/js/language/es/spanish-transforms.js'; +import {LanguageTransformer} from '../ext/js/language/language-transformer.js'; + +const languageTransformer = new LanguageTransformer(); +languageTransformer.addDescriptor(spanishTransforms); + +describe('spanish language transformer', () => { + describe('basic tests', () => { + const nounInflections = [ + 'gatos', + 'sofás', + 'tisús', + 'tisúes', + 'autobuses', + 'ciudades', + 'clics', + 'síes', + 'zigzags', + 'luces', + 'canciones', + ]; + + const verbPresentInflections = [ + 'hablo', + 'hablas', + 'habla', + 'hablamos', + 'habláis', + 'hablan', + 'como', + 'comes', + 'come', + 'comemos', + 'coméis', + 'comen', + 'vivo', + 'vives', + 'vive', + 'vivimos', + 'vivís', + 'viven', + 'tengo', + 'tienes', + 'tiene', + 'tenemos', + 'tenéis', + 'tienen', + 'exijo', + 'extingo', + 'escojo', + 'quepo', + 'caigo', + 'conozco', + 'doy', + 'hago', + 'pongo', + 'sé', + 'salgo', + 'traduzco', + 'traigo', + 'valgo', + 'veo', + 'soy', + 'estoy', + 'voy', + 'he', + ]; + + const verbPreteriteInflections = [ + 'hablé', + 'hablaste', + 'habló', + 'hablamos', + 'hablasteis', + 'hablaron', + 'comí', + 'comiste', + 'comió', + 'comimos', + 'comisteis', + 'comieron', + 'viví', + 'viviste', + 'vivió', + 'vivimos', + 'vivisteis', + 'vivieron', + 'tuve', + 'tuviste', + 'tuvo', + 'tuvimos', + 'tuvisteis', + 'tuvieron', + 'exigí', + 'extinguí', + 'escogí', + 'cupe', + 'caí', + 'conocí', + 'di', + 'hice', + 'puse', + 'supe', + 'salí', + 'traduje', + 'traje', + 'valí', + 'vi', + 'fui', + 'estuve', + 'fui', + 'hube', + ]; + + const basicTransformations = [...nounInflections, ...verbPresentInflections, ...verbPreteriteInflections]; + bench(`spanish transformations (n=${basicTransformations.length})`, () => { + for (const transform of basicTransformations) { + languageTransformer.transform(transform); + } + }); + }); +}); |