From c6b317d0203835cca245a8c42d2c89c0c1ed0433 Mon Sep 17 00:00:00 2001 From: Matt Ickstadt Date: Sat, 15 Jun 2024 13:36:25 -0500 Subject: [PATCH] Fix and run lunr-fixture-gen --- .vscode/launch.json | 18 ++ Cargo.toml | 5 +- js/lunr.ar.js | 95 ------- src/lang/ar.rs | 66 ----- tests/data/ar.in.txt | 7 - tests/data/ar.out.txt | 118 --------- tests/data/hu.out.txt | 60 ++++- tests/data/ja.out.txt | 232 ++-------------- tests/data/ko.out.txt | 36 +-- tests/data/zh.out.txt | 254 +----------------- tests/lunr-fixture-gen/index.js | 23 +- tests/lunr-fixture-gen/package-lock.json | 322 ++++++++++++++++++++++- tests/lunr-fixture-gen/package.json | 7 +- 13 files changed, 440 insertions(+), 803 deletions(-) create mode 100644 .vscode/launch.json delete mode 100644 js/lunr.ar.js delete mode 100644 src/lang/ar.rs delete mode 100644 tests/data/ar.in.txt delete mode 100644 tests/data/ar.out.txt diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..929f7b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch lunr-fixture-gen", + "skipFiles": [ + "/**" + ], + "program": "index.js", + "cwd": "${workspaceFolder}/tests/lunr-fixture-gen", + } + ] +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 5dae316..e88c73d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ name = "bench" harness = false [dev-dependencies] -criterion = "0.4.0" +criterion = "0.5.0" maplit = "1" [dependencies] @@ -37,8 +37,7 @@ lindera = { version = "0.14", optional = true, features = ["ipadic"] } lindera-core = { version = "0.13.5", optional = true } [features] -languages = ["ar", "da", "de", "du", "es", "fi", "fr", "hu", "it", "ja", "ko", "no", "pt", "ro", "ru", "sv", "tr", "zh"] -ar = [] +languages = ["da", "de", "du", "es", "fi", "fr", "hu", "it", "ja", "ko", "no", "pt", "ro", "ru", "sv", "tr", "zh"] da = ["rust-stemmers"] de = ["rust-stemmers"] du = ["rust-stemmers"] diff --git a/js/lunr.ar.js b/js/lunr.ar.js deleted file mode 100644 index f6471ee..0000000 --- a/js/lunr.ar.js +++ /dev/null @@ -1,95 +0,0 @@ -/*! - * Simple Arabic stemmer based on lunr.ar.js from https://github.com/MihaiValentin/lunr-languages - * - * Copyright 2018, Dalia Al-Shahrabi - * http://www.mozilla.org/MPL/ - */ - -/** - * export the module via AMD, CommonJS or as a browser global - * Export code from https://github.com/umdjs/umd/blob/master/returnExports.js - */ -; -(function (root, factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(factory) - } else if (typeof exports === 'object') { - /** - * Node. Does not work with strict CommonJS, but - * only CommonJS-like environments that support module.exports, - * like Node. - */ - module.exports = factory() - } else { - // Browser globals (root is window) - factory()(root.lunr); - } -}(this, function () { - /** - * Just return a value to define the module export. - * This example returns an object, but the module - * can return a function as the exported value. - */ - return function (lunr) { - /* throw error if lunr is not yet included */ - if ('undefined' === typeof lunr) { - throw new Error('Lunr is not present. Please include / require Lunr before this script.'); - } - - /* register specific locale function */ - lunr.ar = function () { - this.pipeline.reset(); - this.pipeline.add( - lunr.ar.stemmer - ); - - // for lunr version 2 - // this is necessary so that every searched word is also stemmed before - // in lunr <= 1 this is not needed, as it is done using the normal pipeline - if (this.searchPipeline) { - this.searchPipeline.reset(); - this.searchPipeline.add(lunr.ar.stemmer) - } - }; - - /* lunr stemmer function */ - lunr.ar.stemmer = (function () { - - /* remove elongating character */ - self.removeElongating = function (word) { - return word.replace(/[\u0640]/gi, ''); - } - - self.removeDiacritics = function (word) { - return word.replace(/[\u064b-\u065b]/gi, ''); - } - - /*Replace all variations of alef (آأإٱى) to a plain alef (ا)*/ - self.cleanAlef = function (word) { - return word.replace(/[\u0622\u0623\u0625\u0671\u0649]/gi, "\u0627"); - } - - self.execArray = [ - 'removeElongating', - 'removeDiacritics', - 'cleanAlef' - ]; - - self.stem = function (word) { - var counter = 0; - while (counter < self.execArray.length) { - word = self[self.execArray[counter]](word); - counter++; - } - return word; - } - - return function (word) { - return self.stem(word); - } - })(); - - lunr.Pipeline.registerFunction(lunr.ar.stemmer, 'stemmer-ar'); - }; -})) \ No newline at end of file diff --git a/src/lang/ar.rs b/src/lang/ar.rs deleted file mode 100644 index d0a640e..0000000 --- a/src/lang/ar.rs +++ /dev/null @@ -1,66 +0,0 @@ -use super::Language; -use crate::pipeline::{Pipeline, PipelineFn}; -use regex::Regex; - -/// Arabic Language -/// -/// Designed to be compatibile with the included Javascript implementation. See `js/lunr.ar.js`. -pub struct Arabic {} - -impl Arabic { - pub fn new() -> Self { - Self {} - } -} - -impl Language for Arabic { - fn name(&self) -> String { - "Arabic".into() - } - fn code(&self) -> String { - "ar".into() - } - - fn tokenize(&self, text: &str) -> Vec { - super::tokenize_whitespace(text) - } - - fn make_pipeline(&self) -> Pipeline { - Pipeline { - queue: vec![Box::new(Stemmer::new())], - } - } -} - -struct Stemmer { - diacritics: Regex, - alefs: Regex, -} - -impl Stemmer { - pub fn new() -> Self { - let diacritics = Regex::new("[\u{0640}\u{064b}-\u{065b}]").unwrap(); - let alefs = Regex::new("[\u{0622}\u{0623}\u{0625}\u{0671}\u{0649}]").unwrap(); - Self { diacritics, alefs } - } -} - -impl PipelineFn for Stemmer { - fn name(&self) -> String { - "stemmer-ar".into() - } - - fn filter(&self, token: String) -> Option { - // remove diacritics and elongating character - let result = self.diacritics.replace(&token, ""); - // replace all variations of alef (آأإٱى) to a plain alef (ا) - let result = self.alefs.replace(&result, "\u{0627}"); - if result.is_empty() { - None - } else if result == token { - Some(token) - } else { - Some(result.into()) - } - } -} diff --git a/tests/data/ar.in.txt b/tests/data/ar.in.txt deleted file mode 100644 index 05067a8..0000000 --- a/tests/data/ar.in.txt +++ /dev/null @@ -1,7 +0,0 @@ -استعار جحا مرة آنية من جاره وعندما أعادها له أعاد معها آنية صغيرة - فسأله جاره لماذا أعدت مع أنيتي آنية صغيرة يا جحا؟ -فقال له جحا: إنّ آنيتك ولدت في الأمس آنية صغيرة وإنّها الآن من حقك، فرح الرجل وأخذ الطنجرة ودخل بيته، -وبعد فترة من الزمان ذهب جحا إلى جاره وطلب منه أنية أخرى، فأعطاه جاره ما طلب، مرّ وقت طويل ولم يُعد جحا الآنية، -فذهب جاره إلى بيته ليطلبها منه، فاستقبله جحا باكياً منتحباً، -فقال له الرجل: مالي أراك باكياً يا جحا؟!! فقال له جحا وهو يبكي إنّ آنيتك توفيت بالأمس يا صاحبي، -فقال له جاره وهو غاضب: وكيف لآنيةٍ أن تموت يا رجل؟!! فقال جحا أتصدق أنّ إناء قد يلد ولا تصدق أنّه قد يموت؟! diff --git a/tests/data/ar.out.txt b/tests/data/ar.out.txt deleted file mode 100644 index fc295d0..0000000 --- a/tests/data/ar.out.txt +++ /dev/null @@ -1,118 +0,0 @@ -استعار -جحا -مرة -انية -من -جاره -وعندما -اعادها -له -اعاد -معها -انية -صغيرة -فساله -جاره -لماذا -اعدت -مع -انيتي -انية -صغيرة -يا -جحا؟ -فقال -له -جحا: -ان -انيتك -ولدت -في -الامس -انية -صغيرة -وانها -الان -من -حقك، -فرح -الرجل -واخذ -الطنجرة -ودخل -بيته، -وبعد -فترة -من -الزمان -ذهب -جحا -الى -جاره -وطلب -منه -انية -اخرى، -فاعطاه -جاره -ما -طلب، -مر -وقت -طويل -ولم -يعد -جحا -الانية، -فذهب -جاره -الى -بيته -ليطلبها -منه، -فاستقبله -جحا -باكيا -منتحبا، -فقال -له -الرجل: -مالي -اراك -باكيا -يا -جحا؟!! -فقال -له -جحا -وهو -يبكي -ان -انيتك -توفيت -بالامس -يا -صاحبي، -فقال -له -جاره -وهو -غاضب: -وكيف -لانية -ان -تموت -يا -رجل؟!! -فقال -جحا -اتصدق -ان -اناء -قد -يلد -ولا -تصدق -انه -قد -يموت؟! diff --git a/tests/data/hu.out.txt b/tests/data/hu.out.txt index c97bb89..522b3a8 100644 --- a/tests/data/hu.out.txt +++ b/tests/data/hu.out.txt @@ -1,7 +1,9 @@ színház újság tartan +tőle megelőz +őket ünneplés tudja bevárn @@ -17,21 +19,26 @@ szép vonás igaz ünnep +is férh bel huszonnégy órás keret mese +is tanítja lakodalm +hár hét tart had kezdődje +há nemzet ünnep tarts +akár április vég elhelyezked @@ -40,11 +47,14 @@ minden választot dátum hivatalos +is +ma hegy völgy tar széles jókedv +szép összeolv ünnep hangulat @@ -56,18 +66,21 @@ tizenegyed folytonosság költő igazság +is megindul -ünneplés +ünneplésből kis epizó terel ezú figyel csekélység +is bevallot pon ünnep progr +nek tetsz véletl szeb @@ -134,7 +147,7 @@ dia ap elmarasztalt jó -műv +művei jelent fényűzés cik @@ -144,6 +157,7 @@ beszerzés egyetem polgár amely +ha dia kiskorú ap @@ -161,6 +175,7 @@ bíró március ítélkezet hár +együt micsod szép ünnep @@ -168,11 +183,13 @@ csinált jó mór tartoz +eb stróf agg költő szem megnedvesed +tőle esz ju negyvennyolcadi @@ -180,13 +197,16 @@ március mostan tavasz dolgozot +hi megtel szív örö fiú ap +ké generáció mérkőzöt +miatt elfogulatl bíró döntés @@ -198,10 +218,16 @@ ifjúság fenntartás szükséges költő +kül diadal +kül ünnep +min +kettő becsületes megérdemelt +nek +jóles március ötvened évforduló @@ -209,10 +235,14 @@ véletl örö tartogatot ember +min +ké március +min +ötv március munká -dicsőség +dicsőségéből kivehett rész progr @@ -221,12 +251,15 @@ epizód ítél nemzet ünneplés +is +ha kis dia véletlen csinál adósság szándékos +egy fogn hely emlékezetes @@ -235,6 +268,7 @@ tavasz hangozhasse cson ünnep +ha idő magyar nemz @@ -260,10 +294,12 @@ beszéd fog elhangozn ünneplő -nemzet +nemzettől kitel +ha ideg nemzet +voln szerencsés helyzet ünneplés @@ -271,17 +307,21 @@ megéret korsz szereplő élő +is láss kör sohas mulasztana +az tegye ünneplés középpont +ha korszak -isten +istentől megáldot poét +kül irodal forrás járn @@ -307,12 +347,16 @@ levelezn kezdet végz különös -kegyelm +kegyelméből +ma +is fá árnye unoka talál pihenő +ha +is szükség spanyol példá @@ -329,10 +373,12 @@ koronázta zorill magyar nemz +is mód találhatt ünnep jó +is programpon talál tegnap @@ -348,6 +394,8 @@ független véletlen nemzet szabadság +is +első katona március jubileum diff --git a/tests/data/ja.out.txt b/tests/data/ja.out.txt index 4169e0a..d2a115e 100644 --- a/tests/data/ja.out.txt +++ b/tests/data/ja.out.txt @@ -1,215 +1,17 @@ -バイト -仲間 -ものすごく -気 -合う -メンバ -い -なぜ -気 -合う -いう -共通 -上司 -い -やつ -どう -いか -ここ -説明 -する -の -割愛 -する -主題 -ずれる -その -い -上司 -愚痴 -言っ -いる -間 -お互い -仲間 -意識 -持っ -い -よう -思う -月日 -流れ -私 -そこ -辞め -しばらく -し -その -気 -合う -メンバ -辞め -何 -回 -その後 -その -メンバ -合っ -いる -うち -意見 -衝突 -険悪 -雰囲気 -なる -こと -増え -そして -私 -面倒 -もう -会わ -よう -なっ -それから -もう -何 -年 -経つ -共通 -敵 -作る -結束 -固まる -話 -よく -聞く -それ -非常 -壊れ -やすい -もの -思う -敵 -去っ -あと -内紛 -起こる -人類 -文明 -発生 -し -地球 -上 -あらゆる -場所 -繰り返し -き -こと -しれ -漢 -劉邦 -中国 -統一 -し -とき -つまり -宿敵 -項羽 -倒し -あと -敵 -い -なっ -その -時 -今 -一緒 -戦っ -き -功臣 -何 -人 -劉邦 -降格 -さ -れ -また -それ -恨み -思っ -功臣 -謀反 -起こし -一族 -ごと -処罰 -受け -し -ただ -軍師 -張 -良 -天下 -統一 -後 -政治 -興味 -あり -研究 -さ -せ -ください -自分 -安全 -アピール -し -の -助かっ -よう -軍師 -成果 -上げる -やはり -人間 -性質 -理解 -し -い -よう -こんな -感じ -共通 -敵 -いる -条件下 -育ま -れ -友情 -よう -もの -いずれ -崩壊 -する -儚い -もの -考え -おく -の -いい -喫煙 -所 -上司 -悪口 -言っ -てる -暇 -あっ -自分 -スキル -アップ -時間 -使う -方 -有益 -言える +バイト仲間で、ものすごく気の合うメンバーがいた +なぜ気が合うかというと、共通の上司がヤバいやつだったからだった +どうヤバいかここで説明するのは割愛する。主題からずれるので +そのヤバい上司の愚痴を言っている間は、お互い仲間意識を持っていたように思う +月日は流れ、私はそこを辞め、しばらくしてその気が合うメンバーも辞めた +何回かその後、そのメンバーと合っているうちに、意見の衝突などから、険悪な雰囲気になることが増えた +そして私も面倒なので、もう会わないようになった +それからもう何年も経つ +共通の敵」を作ると、結束が固まるという話はよく聞くが、それは非常に壊れやすいものと思う +敵が去ったあとは、内紛が起こる +人類に文明が発生してから、地球上のあらゆる場所で繰り返してきたことかもしれない +漢の劉邦が中国を統一したとき、つまり宿敵項羽を倒したあと、敵がいなくなった +その時、今まで一緒に戦ってきた功臣の何人かは、劉邦によって降格されたり、またそれを恨みに思った功臣が謀反を起こし、一族ごと処罰を受けたりもした +ただ、軍師の張良は天下統一の後、「政治には興味ありません。オカルトの研究だけはさせてください」と自分は安全であるというアピールをしたからなのか助かったようである +軍師として成果を上げるくらいだから、やはり人間の性質を理解していたようだ +こんな感じで、共通の敵がいるという条件下で育まれた友情のようなものは、いずれ崩壊する儚いものであると考えておくのがいい +喫煙所で上司の悪口を言ってる暇があったら、自分のスキルアップに時間を使う方が有益と言える diff --git a/tests/data/ko.out.txt b/tests/data/ko.out.txt index 5b16341..e88da75 100644 --- a/tests/data/ko.out.txt +++ b/tests/data/ko.out.txt @@ -1,22 +1,23 @@ 국회는 국가의 예산안을 -심의·확정한다 +심의·확정한다. 헌법재판소의 조직과 운영 필요한 사항은 법률로 -정한다 +정한다. 국회에서 의결된 법률안은 정부에 이송되어 +15일 이내에 대통령이 -공포한다 +공포한다. 국가는 지역간의 균형있는 @@ -24,7 +25,7 @@ 지역경제를 육성할 의무를 -진다 +진다. 국민경제의 발전을 위한 @@ -34,24 +35,24 @@ 자문에 응하기 국민경제자문회의를 -수 +있다. 국가는 전통문화의 계승·발전과 민족문화의 창달에 노력하여야 -한다 +한다. 모든 국민은 인간으로서의 존엄과 가치를 -가지며 +가지며, 행복을 추구할 권리를 -가진다 +가진다. 국가는 개인이 가지는 @@ -62,22 +63,22 @@ 이를 보장할 의무를 -진다 +진다. 중앙선거관리위원회는 대통령이 임명하는 -인 +3인, 국회에서 선출하는 -인과 +3인과 대법원장이 지명하는 -인의 +3인의 위원으로 -구성한다 +구성한다. 위원장은 위원중에서 -호선한다 +호선한다. 국가는 농수산물의 수급균형과 @@ -88,13 +89,14 @@ 도모함으로써 농·어민의 이익을 -보호한다 +보호한다. 국가원로자문회의의 의장은 직전대통령이 -된다 +된다. +다만, 직전대통령이 없을 때에는 대통령이 -지명한다 \ No newline at end of file +지명한다. diff --git a/tests/data/zh.out.txt b/tests/data/zh.out.txt index 82e77a0..5c57917 100644 --- a/tests/data/zh.out.txt +++ b/tests/data/zh.out.txt @@ -1,253 +1 @@ -这 -条 -法国 -邮船 -白 -拉 -日隆 -子爵 -号 -VicomtedeBragelonne -正向 -中国 -开来 -早晨 -八点 -多 -钟 -冲洗 -过 -三等 -三等舱 -甲板 -湿 -意 -未 -干 -但 -已 -坐满 -人 -法国 -国人 -法国人 -德国 -流亡 -出来 -犹太 -犹太人 -印度 -印度人 -安南 -人 -不用 -不用说 -还有 -中国 -人 -海风 -里 -早 -含 -着 -燥热 -胖 -人 -身体 -给 -炎风 -吹干 -上 -一层 -汗 -结 -盐霜 -仿佛 -刚 -在 -巴勒 -勒斯 -巴勒斯 -巴勒斯坦 -死 -海里 -洗过 -洗过澡 -毕竟 -是 -清晨 -人 -兴致 -还 -没 -给 -太阳 -晒 -萎 -烘 -懒 -说话 -做事 -都 -很 -起劲 -那 -几个 -新派 -到 -安南 -或 -中国 -租界 -当 -警察 -法国 -国人 -法国人 -正 -围 -那 -年轻 -善 -撒娇 -犹太 -女人 -在 -调情 -俾斯麦 -曾 -说 -过 -法国 -公使 -大使 -特点 -就是 -一句 -外国 -话 -不会 -讲 -这 -几位 -警察 -并 -不 -懂 -德文 -居然 -传情 -达意 -引得 -犹太 -女人 -格格 -地 -笑 -比 -他们 -外交 -外交官 -强 -多 -这 -女人 -漂亮 -丈夫 -在 -旁 -顾 -而 -乐 -之 -因为 -他 -几天 -来 -香烟 -啤酒 -柠檬 -柠檬水 -沾光 -不少 -红海 -已 -过 -不怕 -热 -极 -引火 -所以 -等 -一会 -甲板 -上 -零星 -果皮 -纸片 -瓶塞 -之外 -香烟 -烟头 -香烟头 -定 -又 -遍 -处 -皆 -是 -法国 -国人 -法国人 -思想 -是 -有名 -清楚 -他 -文章 -也 -明白 -干净 -但是 -他 -做事 -无不 -混乱 -肮脏 -喧哗 -但 -看 -这 -船上 -乱糟 -乱糟糟 -这 -船 -倚仗 -人 -机巧 -载满 -人 -扰攘 -寄满 -人 -希望 -热闹 -地 -行 -着 -分钟 -每分钟 -把 -沾污 -人气 -一小 -方 -小 -面 -还给 -那 -无情 -无尽 -无际 -大海 +这条法国邮船白拉日隆子爵号(vicomtedebragelonne)正向中国开来。早晨八点多钟,冲洗过的三等舱甲板湿意未干,但已坐满了人,法国人、德国流亡出来的犹太人、印度人、安南人,不用说还有中国人。海风里早含着燥热,胖人身体给炎风吹干了,上一层汗结的盐霜,仿佛刚在巴勒斯坦的死海里洗过澡。毕竟是清晨,人的兴致还没给太阳晒萎,烘懒,说话做事都很起劲。那几个新派到安南或中国租界当警察的法国人,正围了那年轻善撒娇的犹太女人在调情。俾斯麦曾说过,法国公使大使的特点,就是一句外国话不会讲;这几位警察并不懂德文,居然传情达意,引得犹太女人格格地笑,比他们的外交官强多了。这女人的漂亮丈夫,在旁顾而乐之,因为他几天来,香烟、啤酒、柠檬水沾光了不少。红海已过,不怕热极引火,所以等一会甲板上零星果皮、纸片、瓶塞之外,香烟头定又遍处皆是。法国人的思想是有名的清楚,他的文章也明白干净,但是他的做事,无不混乱、肮脏、喧哗,但看这船上的乱糟糟。这船,倚仗人的机巧,载满人的扰攘,寄满人的希望,热闹地行着,每分钟把沾污了人气的一小方小面,还给那无情、无尽、无际的大海 diff --git a/tests/lunr-fixture-gen/index.js b/tests/lunr-fixture-gen/index.js index e4dfe35..c8b7df3 100644 --- a/tests/lunr-fixture-gen/index.js +++ b/tests/lunr-fixture-gen/index.js @@ -1,5 +1,6 @@ -var lunr = require('lunr'); +let lunr = require('lunr'); require("lunr-languages/lunr.stemmer.support.js")(lunr); + const fs = require('fs'); for (let file of fs.readdirSync("../data")) { @@ -8,23 +9,27 @@ for (let file of fs.readdirSync("../data")) { let inp = fs.readFileSync(`../data/${code}.in.txt`); let outf = fs.openSync(`../data/${code}.out.txt`, 'w'); - var pipeline = new lunr.Pipeline; - if (code !== "en") - { + let pipeline = new lunr.Pipeline; + if (code !== "en") { + if (code === 'ja') { + let TinySegmenter = require('lunr-languages/tinyseg'); + TinySegmenter(lunr); + } require(`lunr-languages/lunr.${code}.js`)(lunr); - pipeline.add(lunr[code].trimmer); - pipeline.add(lunr[code].stopWordFilter); - pipeline.add(lunr[code].stemmer); + let lang = lunr[code]; + if (lang.trimmer) pipeline.add(lang.trimmer); + if (lang.stopWordFilter) pipeline.add(lang.stopWordFilter); + if (lang.stemmer) pipeline.add(lang.stemmer); } else { pipeline.add(lunr.trimmer); pipeline.add(lunr.stopWordFilter); pipeline.add(lunr.stemmer); } - var tokens = lunr.tokenizer(inp); + let tokens = lunr.tokenizer(inp); tokens = pipeline.run(tokens); - for (var tok of tokens) { + for (let tok of tokens) { tok = tok.toString(); if (tok && tok.length > 0) fs.writeSync(outf, tok + '\n'); diff --git a/tests/lunr-fixture-gen/package-lock.json b/tests/lunr-fixture-gen/package-lock.json index 8a3f63f..d28e57f 100644 --- a/tests/lunr-fixture-gen/package-lock.json +++ b/tests/lunr-fixture-gen/package-lock.json @@ -1,17 +1,317 @@ { "name": "lunr-fixture-gen", + "lockfileVersion": 3, "requires": true, - "lockfileVersion": 1, - "dependencies": { - "lunr": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.1.6.tgz", - "integrity": "sha512-ydJpB8CX8cZ/VE+KMaYaFcZ6+o2LruM6NG76VXdflYTgluvVemz1lW4anE+pyBbLvxJHZdvD1Jy/fOqdzAEJog==" - }, - "lunr-languages": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lunr-languages/-/lunr-languages-1.0.0.tgz", - "integrity": "sha1-gwvKL+hktxPr4T/zPtSO4G5jVyM=" + "packages": { + "": { + "name": "lunr-fixture-gen", + "dependencies": { + "@node-rs/jieba": "^1.10.3", + "lunr": "^2.3.9", + "lunr-languages": "^1.14.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.2.0.tgz", + "integrity": "sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w==", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.0.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", + "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.1.tgz", + "integrity": "sha512-iIBu7mwkq4UQGeMEM8bLwNK962nXdhodeScX4slfQnRhEMMzvYivHhutCIk8uojvmASXXPC2WNEjwxFWk72Oqw==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.4.tgz", + "integrity": "sha512-9zESzOO5aDByvhIAsOy9TbpZ0Ur2AJbUI7UT73kcUTS2mxAMHOBaa1st/jAymNoCtvrit99kkzT1FZuXVcgfIQ==", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.1.0", + "@emnapi/runtime": "^1.1.0", + "@tybys/wasm-util": "^0.9.0" + } + }, + "node_modules/@node-rs/jieba": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba/-/jieba-1.10.3.tgz", + "integrity": "sha512-SG0CWHmhIveH6upJURgymDKLertEPYbOc5NSFIpbZWW1W2MpqgumVteQO+5YBlkmpR6jMNDPWNQyQwkB6HoeNg==", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@node-rs/jieba-android-arm-eabi": "1.10.3", + "@node-rs/jieba-android-arm64": "1.10.3", + "@node-rs/jieba-darwin-arm64": "1.10.3", + "@node-rs/jieba-darwin-x64": "1.10.3", + "@node-rs/jieba-freebsd-x64": "1.10.3", + "@node-rs/jieba-linux-arm-gnueabihf": "1.10.3", + "@node-rs/jieba-linux-arm64-gnu": "1.10.3", + "@node-rs/jieba-linux-arm64-musl": "1.10.3", + "@node-rs/jieba-linux-x64-gnu": "1.10.3", + "@node-rs/jieba-linux-x64-musl": "1.10.3", + "@node-rs/jieba-wasm32-wasi": "1.10.3", + "@node-rs/jieba-win32-arm64-msvc": "1.10.3", + "@node-rs/jieba-win32-ia32-msvc": "1.10.3", + "@node-rs/jieba-win32-x64-msvc": "1.10.3" + } + }, + "node_modules/@node-rs/jieba-android-arm-eabi": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-android-arm-eabi/-/jieba-android-arm-eabi-1.10.3.tgz", + "integrity": "sha512-fuqVtaYlUKZg3cqagYFxj1DSa7ZHKXLle4iGH2kbQWg7Kw6cf7aCYBHIUZuH5sliK10M/CWccZ+SGRUwcSGfbg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-android-arm64": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-android-arm64/-/jieba-android-arm64-1.10.3.tgz", + "integrity": "sha512-iuZZZq5yD9lT+AgaXpFe19gtAsIecUODRLLaBFbavjgjLk5cumv38ytWjS36s/eqptwI15MQfysSYOlWtMEG5g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-darwin-arm64": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-darwin-arm64/-/jieba-darwin-arm64-1.10.3.tgz", + "integrity": "sha512-dwPhkav1tEARskwPz91UUXL2NXy4h0lJYTuJzpGgwXxm552zBM2JJ41kjah1364j+EOq5At3NQvf5r5rH89phQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-darwin-x64": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-darwin-x64/-/jieba-darwin-x64-1.10.3.tgz", + "integrity": "sha512-kjxvV6G1baQo/2I3mELv5qGv4Q0rhd5srwXhypSxMWZFtSpNwCDsLcIOR5bvMBci6QVFfZOs6WD6DKiWVz0SlA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-freebsd-x64": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-freebsd-x64/-/jieba-freebsd-x64-1.10.3.tgz", + "integrity": "sha512-QYTsn+zlWRil+MuBeLfTK5Md4GluOf2lHnFqjrOZW2oMgNOvxB3qoLV4TUf70S/E2XHeP6PUdjCKItX8C7GQPg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-linux-arm-gnueabihf": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-linux-arm-gnueabihf/-/jieba-linux-arm-gnueabihf-1.10.3.tgz", + "integrity": "sha512-UFB43kDOvqmbRl99e3GPwaTuwJZaAvgLaMTvBkmxww4MpQH6G1k31RLzMW/S21uSQso2lj6W/Mm59gaJk2FiyA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-linux-arm64-gnu": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-linux-arm64-gnu/-/jieba-linux-arm64-gnu-1.10.3.tgz", + "integrity": "sha512-bu++yWi10wZtnS5uLcwxzxKmHVT77NgQMK8JiQr1TWCl3Y1Th7CnEHQtxfVB489edDK8l644h1/4zSTe5fRnOQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-linux-arm64-musl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-linux-arm64-musl/-/jieba-linux-arm64-musl-1.10.3.tgz", + "integrity": "sha512-pJh+SzrK1HaKakhdFM+ew9vXwpZqMxy9u0U7J4GT+3GvOwnAZ+KjeaHebIfgOz7ZHvp/T4YBNf8oWW4zwj3AJw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-linux-x64-gnu": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-linux-x64-gnu/-/jieba-linux-x64-gnu-1.10.3.tgz", + "integrity": "sha512-GF5cfvu/0wXO2fVX/XV3WYH/xEGWzMBvfqLhGiA1OA1xHIufnA1T7uU3ZXkyoNi5Bzf6dmxnwtE4CJL0nvhwjQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-linux-x64-musl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-linux-x64-musl/-/jieba-linux-x64-musl-1.10.3.tgz", + "integrity": "sha512-h45HMVU/hgzQ0saXNsK9fKlGdah1i1cXZULpB5vQRlRL2ZIaGp+ULtWTogS7vkoo2K8s2l4tqakWMg9eUjIJ2A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-wasm32-wasi": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-wasm32-wasi/-/jieba-wasm32-wasi-1.10.3.tgz", + "integrity": "sha512-vuoQ62vVoedNGcBmIi4UWdtNBOZG8B+vDYfjx3FD6rNg6g/RgwbVjYXbOVMOQwX06Ob9CfrutICXdUGHgoxzEQ==", + "cpu": [ + "wasm32" + ], + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.2.3" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@node-rs/jieba-win32-arm64-msvc": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-win32-arm64-msvc/-/jieba-win32-arm64-msvc-1.10.3.tgz", + "integrity": "sha512-B8t4dh56TZnMLBoYWDkopf1ed37Ru/iU1qiIeBkbZWXGmNBChNZUOd//eaPOFjx8m9Sfc8bkj3FBRWt/kTAhmw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-win32-ia32-msvc": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-win32-ia32-msvc/-/jieba-win32-ia32-msvc-1.10.3.tgz", + "integrity": "sha512-SKuPGZJ5T+X4jOn1S8LklOSZ6HC7UBiw0hwi2z9uqX6WgElquLjGi/xfZ2gPqffeR/5K/PUu7aqYUUPL1XonVQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/jieba-win32-x64-msvc": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@node-rs/jieba-win32-x64-msvc/-/jieba-win32-x64-msvc-1.10.3.tgz", + "integrity": "sha512-j9I4+a/tf2hsLu8Sr0NhcLBVNBBQctO2mzcjemMpRa1SlEeODyic9RIyP8Ljz3YTN6MYqKh1KA9iR1xvxjxYFg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", + "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==" + }, + "node_modules/lunr-languages": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/lunr-languages/-/lunr-languages-1.14.0.tgz", + "integrity": "sha512-hWUAb2KqM3L7J5bcrngszzISY4BxrXn/Xhbb9TTCJYEGqlR1nG67/M14sp09+PTIRklobrn57IAxcdcO/ZFyNA==" + }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "optional": true } } } diff --git a/tests/lunr-fixture-gen/package.json b/tests/lunr-fixture-gen/package.json index ab43675..29e3f61 100644 --- a/tests/lunr-fixture-gen/package.json +++ b/tests/lunr-fixture-gen/package.json @@ -2,10 +2,11 @@ "name": "lunr-fixture-gen", "main": "index.js", "dependencies": { - "lunr": "^2.1.6", - "lunr-languages": "^1.0.0" + "@node-rs/jieba": "^1.10.3", + "lunr": "^2.3.9", + "lunr-languages": "^1.14.0" }, "scripts": { - "test": "node index.js" + "build": "node index.js" } }