axyseo 2.0.0-alpha.0.0.9 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/languageProcessing/helpers/highlighting/getMarkingsInSentence.js +1 -1
- package/build/languageProcessing/helpers/highlighting/getMarkingsInSentence.js.map +1 -1
- package/build/languageProcessing/helpers/morphology/buildTopicStems.js +1 -1
- package/build/languageProcessing/helpers/morphology/buildTopicStems.js.map +1 -1
- package/build/languageProcessing/helpers/morphology/getAllWordsFromPaper.js +1 -1
- package/build/languageProcessing/helpers/morphology/getAllWordsFromPaper.js.map +1 -1
- package/build/languageProcessing/languages/_default/Researcher.js +1 -1
- package/build/languageProcessing/languages/_default/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/_default/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/_default/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ar/Researcher.js +1 -1
- package/build/languageProcessing/languages/ar/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ar/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ar/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ar/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/ar/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/ca/Researcher.js +1 -1
- package/build/languageProcessing/languages/ca/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ca/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ca/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/cs/Researcher.js +1 -1
- package/build/languageProcessing/languages/cs/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/cs/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/cs/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/cs/values/Clause.js +1 -1
- package/build/languageProcessing/languages/cs/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/de/Researcher.js +1 -1
- package/build/languageProcessing/languages/de/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/de/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/de/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/de/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/de/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/de/values/Clause.js +1 -1
- package/build/languageProcessing/languages/de/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/el/Researcher.js +1 -1
- package/build/languageProcessing/languages/el/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/el/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/el/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/el/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/el/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/el/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/el/values/Clause.js +1 -1
- package/build/languageProcessing/languages/el/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/en/Researcher.js +1 -1
- package/build/languageProcessing/languages/en/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/en/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/en/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/en/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getAdjectiveStem.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getVerbStem.js +1 -1
- package/build/languageProcessing/languages/en/helpers/internal/getVerbStem.js.map +1 -1
- package/build/languageProcessing/languages/en/values/Clause.js +1 -1
- package/build/languageProcessing/languages/en/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/es/Researcher.js +1 -1
- package/build/languageProcessing/languages/es/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/es/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/es/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/es/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/checkVerbStemModifications.js +3 -3
- package/build/languageProcessing/languages/es/helpers/internal/checkVerbStemModifications.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/es/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/es/values/Clause.js +1 -1
- package/build/languageProcessing/languages/es/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/fa/Researcher.js +1 -1
- package/build/languageProcessing/languages/fa/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/createBasicWordForms.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/createBasicWordForms.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/fa/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/fa/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/fr/Researcher.js +1 -1
- package/build/languageProcessing/languages/fr/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/calculateFleschReadingScore.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/calculateFleschReadingScore.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/fr/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/fr/values/Clause.js +1 -1
- package/build/languageProcessing/languages/fr/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/he/Researcher.js +1 -1
- package/build/languageProcessing/languages/he/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/he/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/he/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/he/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/he/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/hu/Researcher.js +1 -1
- package/build/languageProcessing/languages/hu/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/hu/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/hu/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/hu/values/Clause.js +1 -1
- package/build/languageProcessing/languages/hu/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/id/Researcher.js +1 -1
- package/build/languageProcessing/languages/id/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/id/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stemHelpers.js +1 -1
- package/build/languageProcessing/languages/id/helpers/internal/stemHelpers.js.map +1 -1
- package/build/languageProcessing/languages/id/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/id/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/it/Researcher.js +1 -1
- package/build/languageProcessing/languages/it/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/it/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/it/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/it/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/it/values/Clause.js +1 -1
- package/build/languageProcessing/languages/it/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/ja/Researcher.js +1 -1
- package/build/languageProcessing/languages/ja/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/countCharacters.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/countCharacters.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/customGetStemmer.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/customGetStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ja/helpers/getWords.js +1 -1
- package/build/languageProcessing/languages/ja/helpers/getWords.js.map +1 -1
- package/build/languageProcessing/languages/nb/Researcher.js +1 -1
- package/build/languageProcessing/languages/nb/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/nb/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/nb/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/nb/values/Clause.js +1 -1
- package/build/languageProcessing/languages/nb/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/nl/Researcher.js +1 -1
- package/build/languageProcessing/languages/nl/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/checkExceptionsWithFullForms.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/checkExceptionsWithFullForms.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/detectAndStemRegularParticiple.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/detectAndStemRegularParticiple.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/determineStem.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/determineStem.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getStemWordsWithTAndDEnding.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/getStemWordsWithTAndDEnding.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemModificationHelpers.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemModificationHelpers.js.map +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemTOrDFromEndOfWord.js +1 -1
- package/build/languageProcessing/languages/nl/helpers/internal/stemTOrDFromEndOfWord.js.map +1 -1
- package/build/languageProcessing/languages/nl/values/Clause.js +1 -1
- package/build/languageProcessing/languages/nl/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/pl/Researcher.js +1 -1
- package/build/languageProcessing/languages/pl/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/pl/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/pl/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/pl/values/Clause.js +1 -1
- package/build/languageProcessing/languages/pl/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/pt/Researcher.js +1 -1
- package/build/languageProcessing/languages/pt/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/pt/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/pt/values/Clause.js +1 -1
- package/build/languageProcessing/languages/pt/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/ru/Researcher.js +1 -1
- package/build/languageProcessing/languages/ru/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/ru/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/ru/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/ru/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/ru/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/sk/Researcher.js +1 -1
- package/build/languageProcessing/languages/sk/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/getClauses.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/getClauses.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/sk/helpers/internal/getParticiples.js +1 -1
- package/build/languageProcessing/languages/sk/helpers/internal/getParticiples.js.map +1 -1
- package/build/languageProcessing/languages/sk/values/Clause.js +1 -1
- package/build/languageProcessing/languages/sk/values/Clause.js.map +1 -1
- package/build/languageProcessing/languages/sv/Researcher.js +1 -1
- package/build/languageProcessing/languages/sv/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/sv/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/sv/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/sv/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/sv/helpers/isPassiveSentence.js.map +1 -1
- package/build/languageProcessing/languages/tr/Researcher.js +1 -1
- package/build/languageProcessing/languages/tr/Researcher.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/getStemmer.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/getStemmer.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/internal/stem.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/internal/stem.js.map +1 -1
- package/build/languageProcessing/languages/tr/helpers/isPassiveSentence.js +1 -1
- package/build/languageProcessing/languages/tr/helpers/isPassiveSentence.js.map +1 -1
- package/build/parsedPaper/build/linguisticParsing/SentenceTokenizer.js +1 -1
- package/build/parsedPaper/build/linguisticParsing/SentenceTokenizer.js.map +1 -1
- package/build/parsedPaper/build/tree/metadata/buildTree.js +1 -1
- package/build/parsedPaper/build/tree/metadata/buildTree.js.map +1 -1
- package/build/scoring/assessments/assessment.js +1 -1
- package/build/scoring/assessments/assessment.js.map +1 -1
- package/build/scoring/assessments/index.js +5 -5
- package/build/scoring/assessments/index.js.map +1 -1
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js +3 -3
- package/build/scoring/assessments/readability/TransitionWordsAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaDescriptionKeywordAssessment.js.map +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js +1 -1
- package/build/scoring/assessments/seo/MetaTitleKeywordAssessment.js.map +1 -1
- package/build/scoring/assessors/avadaAssessor.js +2 -2
- package/build/scoring/assessors/avadaAssessor.js.map +1 -1
- package/build/scoring/assessors/seoAssessor.js +6 -6
- package/build/scoring/assessors/seoAssessor.js.map +1 -1
- package/build/scoring/helpers/assessments/recommendedKeywordCount.js +1 -1
- package/build/scoring/helpers/assessments/recommendedKeywordCount.js.map +1 -1
- package/build/scoring/helpers/index.js +1 -1
- package/build/scoring/helpers/index.js.map +1 -1
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_regularRootsHufal","_interopRequireDefault","_regularRootsNifal","_regularRootsPual","e","__esModule","default","getWords","languageProcessing","checkHebrewVerbRootsList","word","verbRootsList","affixesList","some","root","affixes","pattern","RegExp","prefix","suffix","test","isPassiveSentence","sentence","words","nifalAffixes","nifalPassive","regularRootsNifal","pualAffixes","pualInfix","pualPassive","regularRootsPual","pualPattern","hufalAffixes","hufalPassive","regularRootsHufal"],"sources":["../../../../../src/languageProcessing/languages/he/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_regularRootsHufal","_interopRequireDefault","_regularRootsNifal","_regularRootsPual","e","__esModule","default","getWords","languageProcessing","checkHebrewVerbRootsList","word","verbRootsList","affixesList","some","root","affixes","pattern","RegExp","prefix","suffix","test","isPassiveSentence","sentence","words","nifalAffixes","nifalPassive","regularRootsNifal","pualAffixes","pualInfix","pualPassive","regularRootsPual","pualPattern","hufalAffixes","hufalPassive","regularRootsHufal"],"sources":["../../../../../src/languageProcessing/languages/he/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nimport regularRootsHufal from '../config/internal/regularRootsHufal';\nimport regularRootsNifal from '../config/internal/regularRootsNifal';\nimport regularRootsPual from '../config/internal/regularRootsPual';\n\n/**\n * Checks if the input word's root is in the Hebrew verb roots list.\n *\n * @param {string} word The word to check.\n * @param {string[]} verbRootsList The Hebrew verb roots list.\n * @param {Object[]} affixesList The list of prefixes and suffixes.\n *\n * @returns {Boolean} Returns true if the root of the input word is in the list.\n */\nconst checkHebrewVerbRootsList = function(word, verbRootsList, affixesList) {\n return verbRootsList.some(root =>\n affixesList.some(function(affixes) {\n const pattern = new RegExp('^' + affixes.prefix + root + affixes.suffix + '$');\n return pattern.test(word);\n })\n );\n};\n\n/**\n * Checks the passed sentence to see if it contains Hebrew passive verb-forms.\n *\n * @param {string} sentence The sentence to match against.\n *\n * @returns {Boolean} Whether the sentence contains Hebrew passive voice.\n */\nexport default function isPassiveSentence(sentence) {\n const words = getWords(sentence);\n for (const word of words) {\n // The list of prefixes and suffixes for nif'al.\n const nifalAffixes = [\n {prefix: '(נ|אי|תי|הי|יי|ני|להי)', suffix: ''},\n {prefix: '(תי|הי)', suffix: '(י|ו|נה)'},\n {prefix: 'נ', suffix: '(ים|ת|ות|תי|ה|נו|תם|תן|ו)'},\n {prefix: 'יי', suffix: 'ו'}\n ];\n\n // Check if the root is in nif'al.\n const nifalPassive = checkHebrewVerbRootsList(word, regularRootsNifal, nifalAffixes);\n\n if (nifalPassive) {\n return true;\n }\n\n // The list of prefixes and suffixes for pu'al.\n const pualAffixes = [\n {prefix: '(מ|א|ת|י|נ)', suffix: ''},\n {prefix: 'תי', suffix: 'נה'},\n {prefix: 'מ', suffix: '(ת|ים|ות)'},\n {prefix: 'ת', suffix: '(י|ו|נה)'},\n {prefix: 'י', suffix: 'ו'},\n {prefix: '', suffix: '(תי|ת|ה|נו|תם|תן|ו)'},\n {prefix: '', suffix: ''}\n ];\n const pualInfix = 'ו';\n\n // Check if the root is in pu'al.\n const pualPassive = regularRootsPual.some(root =>\n pualAffixes.some(function(affixes) {\n const pualPattern = new RegExp(\n '^' + affixes.prefix + root[0] + pualInfix + root[1] + root[2] + affixes.suffix + '$'\n );\n\n return pualPattern.test(word);\n })\n );\n\n if (pualPassive) {\n return true;\n }\n\n // The list of prefixes and suffixes for huf'al.\n const hufalAffixes = [\n {prefix: '(מו|הו|או|תו|יו|נו)', suffix: ''},\n {prefix: 'מו', suffix: '(ת|ים|ות)'},\n {prefix: 'הו', suffix: '(תי|ת|ית|ה|נו|תם|תן|ו)'},\n {prefix: 'תו', suffix: '(ו|נה|י)'},\n {prefix: 'יו', suffix: 'ו'}\n ];\n\n // Check if the root is in huf'al.\n const hufalPassive = checkHebrewVerbRootsList(word, regularRootsHufal, hufalAffixes);\n\n if (hufalPassive) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,iBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAmE,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJnE,MAAM;EAACG;AAAQ,CAAC,GAAGC,yBAAkB;AAMrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAG,SAAAA,CAASC,IAAI,EAAEC,aAAa,EAAEC,WAAW,EAAE;EAC1E,OAAOD,aAAa,CAACE,IAAI,CAACC,IAAI,IAC5BF,WAAW,CAACC,IAAI,CAAC,UAASE,OAAO,EAAE;IACjC,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAC,GAAG,GAAGF,OAAO,CAACG,MAAM,GAAGJ,IAAI,GAAGC,OAAO,CAACI,MAAM,GAAG,GAAG,CAAC;IAC9E,OAAO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C,IAAI,IAC5Ca,WAAW,CAACd,IAAI,CAAC,UAASE,OAAO,EAAE;MACjC,MAAMgB,WAAW,GAAG,IAAId,MAAM,CAC5B,GAAG,GAAGF,OAAO,CAACG,MAAM,GAAGJ,IAAI,CAAC,CAAC,CAAC,GAAGc,SAAS,GAAGd,IAAI,CAAC,CAAC,CAAC,GAAGA,IAAI,CAAC,CAAC,CAAC,GAAGC,OAAO,CAACI,MAAM,GAAG,GACpF,CAAC;MAED,OAAOY,WAAW,CAACX,IAAI,CAACV,IAAI,CAAC;IAC/B,CAAC,CACH,CAAC;IAED,IAAImB,WAAW,EAAE;MACf,OAAO,IAAI;IACb;;IAEA;IACA,MAAMG,YAAY,GAAG,CACnB;MAACd,MAAM,EAAE,qBAAqB;MAAEC,MAAM,EAAE;IAAE,CAAC,EAC3C;MAACD,MAAM,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAW,CAAC,EACnC;MAACD,MAAM,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAwB,CAAC,EAChD;MAACD,MAAM,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAU,CAAC,EAClC;MAACD,MAAM,EAAE,IAAI;MAAEC,MAAM,EAAE;IAAG,CAAC,CAC5B;;IAED;IACA,MAAMc,YAAY,GAAGxB,wBAAwB,CAACC,IAAI,EAAEwB,0BAAiB,EAAEF,YAAY,CAAC;IAEpF,IAAIC,YAAY,EAAE;MAChB,OAAO,IAAI;IACb;EACF;EAEA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _functionWords = _interopRequireDefault(require("./config/functionWords"));
|
|
9
9
|
var _transitionWords = _interopRequireDefault(require("./config/transitionWords"));
|
|
10
10
|
var _twoPartTransitionWords = _interopRequireDefault(require("./config/twoPartTransitionWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Researcher.js","names":["_index","require","_functionWords","_interopRequireDefault","_transitionWords","_twoPartTransitionWords","_firstWordExceptions","_stopWords","_getStemmer","_getClauses","_isPassiveSentence","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","passiveConstructionType","functionWords","transitionWords","twoPartTransitionWords","firstWordExceptions","stopWords","helpers","getStemmer","getClauses","isPassiveSentence","exports"],"sources":["../../../../src/languageProcessing/languages/hu/Researcher.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Researcher.js","names":["_index","require","_functionWords","_interopRequireDefault","_transitionWords","_twoPartTransitionWords","_firstWordExceptions","_stopWords","_getStemmer","_getClauses","_isPassiveSentence","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","passiveConstructionType","functionWords","transitionWords","twoPartTransitionWords","firstWordExceptions","stopWords","helpers","getStemmer","getClauses","isPassiveSentence","exports"],"sources":["../../../../src/languageProcessing/languages/hu/Researcher.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {AbstractResearcher} = languageProcessing;\n\n// All config\nimport functionWords from './config/functionWords';\nimport transitionWords from './config/transitionWords';\nimport twoPartTransitionWords from './config/twoPartTransitionWords';\nimport firstWordExceptions from './config/firstWordExceptions';\nimport stopWords from './config/stopWords';\n\n// All helpers\nimport getStemmer from './helpers/getStemmer';\nimport getClauses from './helpers/getClauses';\nimport isPassiveSentence from './helpers/isPassiveSentence';\n\n/**\n * The researcher contains all the researches, helpers, data, and config.\n */\nexport default class Researcher extends AbstractResearcher {\n /**\n * Constructor\n * @param {Paper} paper The Paper object that is needed within the researches.\n * @constructor\n */\n constructor(paper) {\n super(paper);\n\n // Deletes researches that are currently not available in Hungarian.\n // When the research is available, this line should be removed.\n delete this.defaultResearches.getFleschReadingScore;\n\n Object.assign(this.config, {\n language: 'hu',\n passiveConstructionType: 'morphologicalAndPeriphrastic',\n functionWords,\n transitionWords,\n twoPartTransitionWords,\n firstWordExceptions,\n stopWords\n });\n\n Object.assign(this.helpers, {\n getStemmer,\n getClauses,\n isPassiveSentence\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,uBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,oBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,UAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAGA,IAAAO,WAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,kBAAA,GAAAP,sBAAA,CAAAF,OAAA;AAA4D,SAAAE,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ5D,MAAM;EAACG;AAAkB,CAAC,GAAGC,yBAAkB;;AAE/C;;AAOA;;AAKA;AACA;AACA;AACe,MAAMC,UAAU,SAASF,kBAAkB,CAAC;EACzD;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;;IAEZ;IACA;IACA,OAAO,IAAI,CAACC,iBAAiB,CAACC,qBAAqB;IAEnDC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACC,MAAM,EAAE;MACzBC,QAAQ,EAAE,IAAI;MACdC,uBAAuB,EAAE,8BAA8B;MACvDC,aAAa,EAAbA,sBAAa;MACbC,eAAe,EAAfA,wBAAe;MACfC,sBAAsB,EAAtBA,+BAAsB;MACtBC,mBAAmB,EAAnBA,4BAAmB;MACnBC,SAAS,EAATA;IACF,CAAC,CAAC;IAEFT,MAAM,CAACC,MAAM,CAAC,IAAI,CAACS,OAAO,EAAE;MAC1BC,UAAU,EAAVA,mBAAU;MACVC,UAAU,EAAVA,mBAAU;MACVC,iBAAiB,EAAjBA;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAtB,OAAA,GAAAG,UAAA","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getHungarianClauses;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _Clause = _interopRequireDefault(require("../values/Clause"));
|
|
9
9
|
var _auxiliaries = _interopRequireDefault(require("../config/internal/auxiliaries.js"));
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("../config/stopWords.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_auxiliaries","_stopWords","e","__esModule","default","getClausesSplitOnStopWords","createRegexFromArray","languageProcessing","options","Clause","HungarianClause","regexes","auxiliaryRegex","auxiliaries","allAuxiliaries","stopwordRegex","stopWords","getHungarianClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_auxiliaries","_stopWords","e","__esModule","default","getClausesSplitOnStopWords","createRegexFromArray","languageProcessing","options","Clause","HungarianClause","regexes","auxiliaryRegex","auxiliaries","allAuxiliaries","stopwordRegex","stopWords","getHungarianClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getClausesSplitOnStopWords, createRegexFromArray} = languageProcessing;\n\nimport HungarianClause from '../values/Clause';\nimport auxiliaries from '../config/internal/auxiliaries.js';\nimport stopWords from '../config/stopWords.js';\n\nconst options = {\n Clause: HungarianClause,\n regexes: {\n auxiliaryRegex: createRegexFromArray(auxiliaries.allAuxiliaries),\n stopwordRegex: createRegexFromArray(stopWords)\n }\n};\n\n/**\n * Gets the clauses from a sentence by determining sentence breakers.\n *\n * @param {string} sentence The sentence to split up in clauses.\n *\n * @returns {Array} The array with all clauses that have an auxiliary.\n */\nexport default function getHungarianClauses(sentence) {\n return getClausesSplitOnStopWords(sentence, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA+C,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ/C,MAAM;EAACG,0BAA0B;EAAEC;AAAoB,CAAC,GAAGC,yBAAkB;AAM7E,MAAMC,OAAO,GAAG;EACdC,MAAM,EAAEC,eAAe;EACvBC,OAAO,EAAE;IACPC,cAAc,EAAEN,oBAAoB,CAACO,oBAAW,CAACC,cAAc,CAAC;IAChEC,aAAa,EAAET,oBAAoB,CAACU,kBAAS;EAC/C;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,mBAAmBA,CAACC,QAAQ,EAAE;EACpD,OAAOb,0BAA0B,CAACa,QAAQ,EAAEV,OAAO,CAAC;AACtD","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getStemmer;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _stem = _interopRequireDefault(require("./internal/stem"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {baseStemmer} = languageProcessing;\n\nimport stem from './internal/stem';\n\n/**\n * Returns the stemmer for a researcher.\n *\n * @param {Researcher} researcher The researcher.\n *\n * @returns {Function} The stemmer.\n */\nexport default function getStemmer(researcher) {\n const morphologyData = get(researcher.getData('morphology'), 'hu', false);\n\n if (morphologyData) {\n return word => stem(word, morphologyData);\n }\n\n return baseStemmer;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFnC,MAAM;EAACG;AAAW,CAAC,GAAGC,yBAAkB;AAIxC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAACC,UAAU,EAAE;EAC7C,MAAMC,cAAc,GAAG,IAAAC,WAAG,EAACF,UAAU,CAACG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAEzE,IAAIF,cAAc,EAAE;IAClB,OAAOG,IAAI,IAAI,IAAAC,aAAI,EAACD,IAAI,EAAEH,cAAc,CAAC;EAC3C;EAEA,OAAOJ,WAAW;AACpB","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _participles = _interopRequireDefault(require("../../config/internal/participles.js"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getParticiples.js","names":["_index","require","_participles","_interopRequireDefault","e","__esModule","default","getWords","languageProcessing","_default","clauseText","words","participleEndingsRegex","RegExp","filter","word","test","participlesInReAndRa","includes"],"sources":["../../../../../../src/languageProcessing/languages/hu/helpers/internal/getParticiples.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getParticiples.js","names":["_index","require","_participles","_interopRequireDefault","e","__esModule","default","getWords","languageProcessing","_default","clauseText","words","participleEndingsRegex","RegExp","filter","word","test","participlesInReAndRa","includes"],"sources":["../../../../../../src/languageProcessing/languages/hu/helpers/internal/getParticiples.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nimport participlesInReAndRa from '../../config/internal/participles.js';\n\n/**\n * Creates an array of participles found in a clause.\n *\n * @param {string} clauseText The clause to finds participles in.\n *\n * @returns {Array} The array with the participles.\n */\nexport default function(clauseText) {\n const words = getWords(clauseText);\n\n const participleEndingsRegex = new RegExp('(ve|va|ódni|ődni)$');\n\n return words.filter(\n word => participleEndingsRegex.test(word) || participlesInReAndRa.includes(word)\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAwE,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFxE,MAAM;EAACG;AAAQ,CAAC,GAAGC,yBAAkB;AAIrC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAAC,SAASC,UAAU,EAAE;EAClC,MAAMC,KAAK,GAAGJ,QAAQ,CAACG,UAAU,CAAC;EAElC,MAAME,sBAAsB,GAAG,IAAIC,MAAM,CAAC,oBAAoB,CAAC;EAE/D,OAAOF,KAAK,CAACG,MAAM,CACjBC,IAAI,IAAIH,sBAAsB,CAACI,IAAI,CAACD,IAAI,CAAC,IAAIE,oBAAoB,CAACC,QAAQ,CAACH,IAAI,CACjF,CAAC;AACH","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isPassiveSentence;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _odikVerbs = _interopRequireDefault(require("../config/internal/odikVerbs"));
|
|
9
9
|
var _morphologicalPassiveAffixes = require("../config/internal/morphologicalPassiveAffixes");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_odikVerbs","_interopRequireDefault","_morphologicalPassiveAffixes","e","__esModule","default","getWords","languageProcessing","checkHungarianPassive","word","verbRootsList","prefixes","suffixes","some","root","suffix","rootAndSuffix","endsWith","beforeRoot","slice","indexOf","includes","isPassiveSentence","sentence","words","passiveVerbs1","passiveVerbs","odikVerbStems1","passiveVerbs2","odikVerbStems2","verbPrefixes","odikSuffixes1","odikSuffixes2"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_odikVerbs","_interopRequireDefault","_morphologicalPassiveAffixes","e","__esModule","default","getWords","languageProcessing","checkHungarianPassive","word","verbRootsList","prefixes","suffixes","some","root","suffix","rootAndSuffix","endsWith","beforeRoot","slice","indexOf","includes","isPassiveSentence","sentence","words","passiveVerbs1","passiveVerbs","odikVerbStems1","passiveVerbs2","odikVerbStems2","verbPrefixes","odikSuffixes1","odikSuffixes2"],"sources":["../../../../../src/languageProcessing/languages/hu/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nimport passiveVerbs from '../config/internal/odikVerbs';\nimport {\n verbPrefixes,\n odikSuffixes1,\n odikSuffixes2\n} from '../config/internal/morphologicalPassiveAffixes';\n\n/**\n * Checks if the input word's root is in the Hungarian verb roots list.\n *\n * @param {string} word The word to check.\n * @param {string[]} verbRootsList The Hungarian verb roots list.\n * @param {string[]} prefixes The list of prefixes.\n * @param {string[]} suffixes The list of suffixes.\n *\n * @returns {Boolean} Returns true if the root of the input word is in the list.\n */\nconst checkHungarianPassive = function(word, verbRootsList, prefixes, suffixes) {\n return verbRootsList.some(root => {\n return suffixes.some(function(suffix) {\n const rootAndSuffix = root + suffix;\n\n // Check whether the word ends in a root + suffix combination.\n if (word.endsWith(rootAndSuffix)) {\n const beforeRoot = word.slice(0, word.indexOf(rootAndSuffix));\n\n // Word is passive if nothing precedes the root or the root is preceded by a valid prefix.\n return beforeRoot === '' || prefixes.includes(beforeRoot);\n }\n });\n });\n};\n\n/**\n * Checks the passed sentence to see if it contains Hungarian passive verb-forms.\n *\n * @param {string} sentence The sentence to match against.\n *\n * @returns {Boolean} Whether the sentence contains Hungarian passive voice.\n */\nexport default function isPassiveSentence(sentence) {\n const words = getWords(sentence);\n const passiveVerbs1 = passiveVerbs.odikVerbStems1;\n const passiveVerbs2 = passiveVerbs.odikVerbStems2;\n\n return words.some(\n word =>\n checkHungarianPassive(word, passiveVerbs1, verbPrefixes, odikSuffixes1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AACC,IAAI,EAAEgB,aAAa,EAAEK,yCAAY,EAAEC,0CAAa,CAAC,IACvEvB,qBAAqB,CAACC,IAAI,EAAEmB,aAAa,EAAEE,yCAAY,EAAEE,0CAAa,CAC1E,CAAC;AACH","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _getParticiples = _interopRequireDefault(require("../helpers/internal/getParticiples"));
|
|
9
9
|
var _nonPassivesInVaAndVe = _interopRequireDefault(require("../config/internal/nonPassivesInVaAndVe"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clause.js","names":["_index","require","_getParticiples","_interopRequireDefault","_nonPassivesInVaAndVe","e","__esModule","default","values","languageProcessing","Clause","HungarianClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","foundParticiples","filter","participle","nonPassivesInVaAndVe","includes","setPassive","length","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/hu/values/Clause.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Clause.js","names":["_index","require","_getParticiples","_interopRequireDefault","_nonPassivesInVaAndVe","e","__esModule","default","values","languageProcessing","Clause","HungarianClause","constructor","clauseText","auxiliaries","_participles","getParticiples","getClauseText","checkParticiples","foundParticiples","filter","participle","nonPassivesInVaAndVe","includes","setPassive","length","_default","exports"],"sources":["../../../../../src/languageProcessing/languages/hu/values/Clause.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {values} = languageProcessing;\nconst {Clause} = values;\n\nimport getParticiples from '../helpers/internal/getParticiples';\nimport nonPassivesInVaAndVe from '../config/internal/nonPassivesInVaAndVe';\n\n/**\n * Creates a Clause object for the Hungarian language.\n */\nclass HungarianClause extends Clause {\n /**\n * Constructor.\n *\n * @param {string} clauseText The text of the clause.\n * @param {Array} auxiliaries The auxiliaries.\n *\n * @constructor\n */\n constructor(clauseText, auxiliaries) {\n super(clauseText, auxiliaries);\n this._participles = getParticiples(this.getClauseText());\n this.checkParticiples();\n }\n\n /**\n * Checks if any exceptions are applicable to this participle that would result in the clause not being passive.\n * If no exceptions are found, the clause is passive.\n *\n * @returns {void}\n */\n checkParticiples() {\n const foundParticiples = this.getParticiples().filter(\n participle => !nonPassivesInVaAndVe.includes(participle)\n );\n\n this.setPassive(foundParticiples.length > 0);\n }\n}\n\nexport default HungarianClause;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA2E,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ3E,MAAM;EAACG;AAAM,CAAC,GAAGC,yBAAkB;AACnC,MAAM;EAACC;AAAM,CAAC,GAAGF,MAAM;AAKvB;AACA;AACA;AACA,MAAMG,eAAe,SAASD,MAAM,CAAC;EACnC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,WAAWA,CAACC,UAAU,EAAEC,WAAW,EAAE;IACnC,KAAK,CAACD,UAAU,EAAEC,WAAW,CAAC;IAC9B,IAAI,CAACC,YAAY,GAAG,IAAAC,uBAAc,EAAC,IAAI,CAACC,aAAa,CAAC,CAAC,CAAC;IACxD,IAAI,CAACC,gBAAgB,CAAC,CAAC;EACzB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEA,gBAAgBA,CAAA,EAAG;IACjB,MAAMC,gBAAgB,GAAG,IAAI,CAACH,cAAc,CAAC,CAAC,CAACI,MAAM,CACnDC,UAAU,IAAI,CAACC,6BAAoB,CAACC,QAAQ,CAACF,UAAU,CACzD,CAAC;IAED,IAAI,CAACG,UAAU,CAACL,gBAAgB,CAACM,MAAM,GAAG,CAAC,CAAC;EAC9C;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEcI,eAAe","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _firstWordExceptions = _interopRequireDefault(require("./config/firstWordExceptions"));
|
|
9
9
|
var _functionWords = require("./config/functionWords");
|
|
10
10
|
var _transitionWords = _interopRequireDefault(require("./config/transitionWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_transitionWords","_twoPartTransitionWords","_getStemmer","_isPassiveSentence","_splitIntoTokensCustom","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","transitionWords","twoPartTransitionWords","areHyphensWordBoundaries","helpers","getStemmer","isPassiveSentence","splitIntoTokensCustom","exports"],"sources":["../../../../src/languageProcessing/languages/id/Researcher.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_transitionWords","_twoPartTransitionWords","_getStemmer","_isPassiveSentence","_splitIntoTokensCustom","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","defaultResearches","getFleschReadingScore","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","transitionWords","twoPartTransitionWords","areHyphensWordBoundaries","helpers","getStemmer","isPassiveSentence","splitIntoTokensCustom","exports"],"sources":["../../../../src/languageProcessing/languages/id/Researcher.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {AbstractResearcher} = languageProcessing;\n\n// All config\nimport firstWordExceptions from './config/firstWordExceptions';\nimport {all as functionWords} from './config/functionWords';\nimport transitionWords from './config/transitionWords';\nimport twoPartTransitionWords from './config/twoPartTransitionWords';\n\n// All helpers\nimport getStemmer from './helpers/getStemmer';\nimport isPassiveSentence from './helpers/isPassiveSentence';\nimport splitIntoTokensCustom from './helpers/splitIntoTokensCustom';\n\n/**\n * The researcher contains all the researches, helpers, data, and config.\n */\nexport default class Researcher extends AbstractResearcher {\n /**\n * Constructor\n * @param {Paper} paper The Paper object that is needed within the researches.\n * @constructor\n */\n constructor(paper) {\n super(paper);\n\n // Delete the researches that are not available for Indonesian.\n delete this.defaultResearches.getFleschReadingScore;\n\n Object.assign(this.config, {\n language: 'id',\n passiveConstructionType: 'morphological',\n firstWordExceptions,\n functionWords,\n transitionWords,\n twoPartTransitionWords,\n areHyphensWordBoundaries: false\n });\n\n Object.assign(this.helpers, {\n getStemmer,\n isPassiveSentence,\n splitIntoTokensCustom\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,uBAAA,GAAAH,sBAAA,CAAAF,OAAA;AAGA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,kBAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,sBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAoE,SAAAE,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAXpE,MAAM;EAACG;AAAkB,CAAC,GAAGC,yBAAkB;;AAE/C;;AAMA;;AAKA;AACA;AACA;AACe,MAAMC,UAAU,SAASF,kBAAkB,CAAC;EACzD;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;;IAEZ;IACA,OAAO,IAAI,CAACC,iBAAiB,CAACC,qBAAqB;IAEnDC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACC,MAAM,EAAE;MACzBC,QAAQ,EAAE,IAAI;MACdC,uBAAuB,EAAE,eAAe;MACxCC,mBAAmB,EAAnBA,4BAAmB;MACnBC,aAAa,EAAbA,kBAAa;MACbC,eAAe,EAAfA,wBAAe;MACfC,sBAAsB,EAAtBA,+BAAsB;MACtBC,wBAAwB,EAAE;IAC5B,CAAC,CAAC;IAEFT,MAAM,CAACC,MAAM,CAAC,IAAI,CAACS,OAAO,EAAE;MAC1BC,UAAU,EAAVA,mBAAU;MACVC,iBAAiB,EAAjBA,0BAAiB;MACjBC,qBAAqB,EAArBA;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAtB,OAAA,GAAAG,UAAA","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getStemmer;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _stem = _interopRequireDefault(require("./internal/stem"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/id/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/id/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {baseStemmer} = languageProcessing;\n\nimport stem from './internal/stem';\n\n/**\n * Returns the stemmer for a researcher.\n *\n * @param {Researcher} researcher The researcher.\n *\n * @returns {Function} The stemmer.\n */\nexport default function getStemmer(researcher) {\n const morphologyData = get(researcher.getData('morphology'), 'id', false);\n\n if (morphologyData) {\n return word => stem(word, morphologyData);\n }\n\n return baseStemmer;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFnC,MAAM;EAACG;AAAW,CAAC,GAAGC,yBAAkB;AAIxC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAACC,UAAU,EAAE;EAC7C,MAAMC,cAAc,GAAG,IAAAC,WAAG,EAACF,UAAU,CAACG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAEzE,IAAIF,cAAc,EAAE;IAClB,OAAOG,IAAI,IAAI,IAAAC,aAAI,EAACD,IAAI,EAAEH,cAAc,CAAC;EAC3C;EAEA,OAAOJ,WAAW;AACpB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stem.js","names":["_index","require","_stemHelpers","flattenSortLength","buildFormRule","createRulesFromArrays","languageProcessing","checkSingleSyllableWordSuffix","word","suffixesArray","suffix","match","stemSingleSyllableWordsPrefixes","morphologyData","startsWith","checkBeginningsList","stemming","singleSyllableWords","substring","length","test","stemSingleSyllableWords","suffixCombination","singleSyllableWordsSuffixes","inputWord","some","shortWord","calculateTotalNumberOfSyllables","removeEnding","regexRules","removeParticle","doNotStemWords","doNotStemParticle","removePronoun","doNotStemPronounSuffix","wordWithoutDerivationalSuffix","removeSuffixes","doNotStemSuffix","includes","tryStemmingKeAndTer","terException","doNotStemPrefix","doNotStemFirstOrderPrefix","doNotStemTer","wordWithTer","beginningModification","rBeginning","replace","checkFirstOrderPrefixExceptions","nBeginning","kBeginning","pBeginning","mBeginning","wordAfterKeTerCheck","removeFirstOrderPrefix","firstOrderPrefixException","regex","removeFirstOrderPrefixes","withRemovedFirstOrderPrefix","removeSecondOrderPrefix","removeSecondOrderPrefixes","withRemovedSecondOrderPrefix","stemDerivational","wordLength","removeSuffixRules","removeSuffixExceptions","doNotStemSecondOrderPrefix","wordWithPrefixLookAlike","stemSingular","doNotStemPronoun","firstDerivationalStem","stemPlural","hyphenIndex","indexOf","splitWord","split","firstPart","secondPart","firstPartBeginningTrimmed","secondPartBeginningTrimmed","nonPlurals","nonPluralReduplications","stem","shouldNotBeStemmed","stemmedPlural"],"sources":["../../../../../../src/languageProcessing/languages/id/helpers/internal/stem.js"],"sourcesContent":["import {languageProcessing} from '@axyseo/index';\nconst {flattenSortLength, buildFormRule, createRulesFromArrays} = languageProcessing;\n\nimport {calculateTotalNumberOfSyllables, removeEnding, checkBeginningsList} from './stemHelpers';\n\n/**\n * MIT License\n *\n * Adapted from: Copyright (c) 2013 Adinda Praditya\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software\n * and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\"\n */\n\n/**\n * Checks if a single syllable word has one of the suffixes/suffix combination.\n *\n * @param {string} word The word to check.\n * @param {Array} suffixesArray The array of suffixes\n * @returns {boolean} Whether the word ends in one of the suffixes or not.\n */\nconst checkSingleSyllableWordSuffix = function(word, suffixesArray) {\n for (const suffix of suffixesArray) {\n if (word.match(suffix)) {\n return true;\n }\n }\n};\n\n/**\n * Stems the prefix of the single syllable words, i.e. di-/penge-/menge-\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string} The stemmed word.\n */\nconst stemSingleSyllableWordsPrefixes = function(word, morphologyData) {\n // If the word gets prefix di-, stem the prefix here. E.g. dicekkanlah -> cekkanlah, dibomi -> bomi\n if (\n word.startsWith('di') &&\n checkBeginningsList(word, 2, morphologyData.stemming.singleSyllableWords)\n ) {\n return word.substring(2, word.length);\n }\n /*\n * If the word gets prefix menge-/penge- and is followed by one of the words in the list, stem the prefix here.\n * E.g. pengeboman -> boman\n */\n if (\n /^[mp]enge/i.test(word) &&\n checkBeginningsList(word, 5, morphologyData.stemming.singleSyllableWords)\n ) {\n return word.substring(5, word.length);\n }\n return word;\n};\n\n/**\n * Stems Indonesian single syllable words. This function concerns single syllable words\n * with this possible word format [di/penge/menge] + single syllable word + [kan/an/i] + [ku/mu/nya] + [kah/lah/pun], with [] being optional.\n * E.g. dipel -> pel, dipelkan -> pel, dipelkanlah -> pel, pelkan -> pel, pelmulah -> pel, pengeboman -> bom, mengesahkan -> sah\n *\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string} The stemmed word.\n */\nconst stemSingleSyllableWords = function(word, morphologyData) {\n const singleSyllableWords = morphologyData.stemming.singleSyllableWords;\n const suffixCombination = morphologyData.stemming.singleSyllableWordsSuffixes;\n const inputWord = word;\n // If the word starts with prefix di-/penge-/menge-, stem the prefix here. E.g. pengeboman -> boman, dipelkan -> pelkan\n word = stemSingleSyllableWordsPrefixes(word, morphologyData);\n\n // Check if a word starts with one of the words in the list, has maximum 3 syllables, and ends in one of the single syllable suffixes\n if (\n singleSyllableWords.some(shortWord => word.startsWith(shortWord)) &&\n calculateTotalNumberOfSyllables(word) <= 3 &&\n checkSingleSyllableWordSuffix(word, suffixCombination)\n ) {\n // If the word gets a particle suffix, stem the particle. E.g. cekkanlah -> cekkan, pelkan -> pel, vasmulah -> vasmu\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeParticle,\n morphologyData.stemming.doNotStemWords.doNotStemParticle,\n morphologyData\n );\n\n // If the word gets a possessive pronoun suffix, stem the possessive pronoun. E.g. vasmu -> vas\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removePronoun,\n morphologyData.stemming.doNotStemWords.doNotStemPronounSuffix,\n morphologyData\n );\n\n // If the word ends in -kan/-an/-i suffix, stem the suffix. E.g. cekkan -> cek, bomi -> bom\n const wordWithoutDerivationalSuffix = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeSuffixes,\n morphologyData.stemming.doNotStemWords.doNotStemSuffix,\n morphologyData\n );\n\n if (singleSyllableWords.includes(wordWithoutDerivationalSuffix)) {\n word = wordWithoutDerivationalSuffix;\n }\n }\n /*\n * We only want to stem single syllable words here.\n * Thus, if the output word has more than one syllable, we don't stem the input word at all.\n */\n if (calculateTotalNumberOfSyllables(word) > 1 || word.length === 1) {\n word = inputWord;\n }\n return word;\n};\n\n/**\n * Tries stemming prefixes ke- and ter-. Ke- is always stemmed, and ter- only if it is a prefix and not part of the stem.\n * Also if the stem of the word begins with r-, only te- is stemmed, not ter-.\n *\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n * @param {string}\tword\t\t\tThe word to check.\n *\n * @returns {string|null}\tThe stem or null if the word did not start with ter/keter.\n */\nconst tryStemmingKeAndTer = function(morphologyData, word) {\n const terException =\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemFirstOrderPrefix.doNotStemTer;\n\n // If prefix -ter is preceded by prefix -ke, remove it first.\n if (word.startsWith('keter')) {\n word = word.substring(2, word.length);\n }\n if (word.startsWith('ter')) {\n // If word is on an exception list of words where -ter should not be stemmed, do not stem -ter and return the word.\n if (terException.some(wordWithTer => word.startsWith(wordWithTer))) {\n return word;\n }\n // If word (without prefixes) is on the list of words beginning with -r, remove only -te instead of -ter.\n if (checkBeginningsList(word, 3, morphologyData.stemming.beginningModification.rBeginning)) {\n return word.replace(/^ter/i, 'r');\n }\n // Otherwise, remove -ter.\n return word.substring(3, word.length);\n }\n};\n/**\n * Checks whether a word has a first order prefix and whether it is on an exception list of words which require a stem mofification\n * after removing the prefix. Returns the stem if the prefix was found and the word was matched on an exception list.\n *\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string|null}\tThe stem or null if a prefix was not found, or was found but the word was not on the exception list.\n */\nconst checkFirstOrderPrefixExceptions = function(word, morphologyData) {\n const beginningModification = morphologyData.stemming.beginningModification;\n\n // If a word starts with \"men\" or \"pen\" and is present in the nBeginning exception list, the prefix should be replaced with \"n\".\n if (/^[mp]en/i.test(word)) {\n if (checkBeginningsList(word, 3, beginningModification.nBeginning)) {\n return word.replace(/^[mp]en/i, 'n');\n }\n }\n if (/^[mp]eng/i.test(word) && checkBeginningsList(word, 4, beginningModification.kBeginning)) {\n return word.replace(/^[mp]eng/i, 'k');\n }\n\n if (/^[mp]em/i.test(word)) {\n if (checkBeginningsList(word, 3, beginningModification.pBeginning)) {\n return word.replace(/^(mem|pem)/i, 'p');\n } else if (checkBeginningsList(word, 3, beginningModification.mBeginning)) {\n return word.replace(/^(mem|pem)/i, 'm');\n }\n }\n // Stem prefix ke- if found. Stem te(r)- unless the word was found on the exception list of words with stem beginning in -ter.\n const wordAfterKeTerCheck = tryStemmingKeAndTer(morphologyData, word);\n if (wordAfterKeTerCheck) {\n return wordAfterKeTerCheck;\n }\n};\n\n/**\n * Stems the first-order prefix of a word based on regexRules. If the word is found in an exception list, implements a stem modification.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst removeFirstOrderPrefix = function(word, morphologyData) {\n // Checks whether the word has a first order prefix and requires a stem modification.\n const firstOrderPrefixException = checkFirstOrderPrefixExceptions(word, morphologyData);\n\n if (firstOrderPrefixException) {\n return firstOrderPrefixException;\n }\n const regex = createRulesFromArrays(morphologyData.stemming.regexRules.removeFirstOrderPrefixes);\n const withRemovedFirstOrderPrefix = buildFormRule(word, regex);\n\n return withRemovedFirstOrderPrefix || word;\n};\n\n/**\n * Stems the second-order prefix of a word based on regexRules. If the word is found in an exception list, implements a stem modification.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst removeSecondOrderPrefix = function(word, morphologyData) {\n // If a word starts with \"ber\" or \"per\" and is present in the rBeginning exception list, the prefix should be replaced with \"r\".\n if (\n (word.startsWith('ber') || word.startsWith('per')) &&\n checkBeginningsList(word, 3, morphologyData.stemming.beginningModification.rBeginning)\n ) {\n return word.replace(/^(ber|per)/i, 'r');\n }\n // If a word starts with a first order prefix followed by peng- and is in the kBeginning exception list, then peng- should be replaced with k.\n if (\n /^peng/i.test(word) &&\n checkBeginningsList(word, 4, morphologyData.stemming.beginningModification.kBeginning)\n ) {\n return word.replace(/^peng/i, 'k');\n }\n const regex = createRulesFromArrays(morphologyData.stemming.regexRules.removeSecondOrderPrefixes);\n const withRemovedSecondOrderPrefix = buildFormRule(word, regex);\n\n return withRemovedSecondOrderPrefix || word;\n};\n\n/**\n * Stems derivational affixes of Indonesian words.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst stemDerivational = function(word, morphologyData) {\n let wordLength = word.length;\n const removeSuffixRules = morphologyData.stemming.regexRules.removeSuffixes;\n const removeSuffixExceptions = morphologyData.stemming.doNotStemWords.doNotStemSuffix;\n const doNotStemFirstOrderPrefix = flattenSortLength(\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemFirstOrderPrefix\n );\n const doNotStemSecondOrderPrefix = flattenSortLength(\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemSecondOrderPrefix\n );\n\n // If a word is in the list of words with a beginning that looks like a valid suffix, do not stem the suffix\n if (\n !doNotStemFirstOrderPrefix.some(wordWithPrefixLookAlike =>\n word.startsWith(wordWithPrefixLookAlike)\n )\n ) {\n /*\n * If the word has more than 2 syllables and starts with one of first order prefixes (i.e. meng-, meny-, men-, mem-, me-,\n * peng-, peny-, pen-, pem-, di-, ter-, ke- ), the prefix will be stemmed here. e.g. penyebaran -> sebaran, diperlebarkan -> perlebarkan\n */\n word = removeFirstOrderPrefix(word, morphologyData);\n }\n\n if (wordLength === word.length) {\n if (\n !doNotStemSecondOrderPrefix.some(wordWithPrefixLookAlike =>\n word.startsWith(wordWithPrefixLookAlike)\n )\n ) {\n /*\n * If the word does not start with one of the first order prefixes but starts with one of the second order prefixes,\n * the prefix will be stemmed here, e.g., peranakan -> anakan\n */\n word = removeSecondOrderPrefix(word, morphologyData);\n }\n // If the word has more than 2 syllables and ends in either -kan, -an, or -i suffixes, the suffix will be deleted here, e.g., anakan -> anak\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeEnding(word, removeSuffixRules, removeSuffixExceptions, morphologyData);\n }\n } else {\n // If the word previously had a first order prefix, assign wordLength to the length of the word after prefix deletion.\n wordLength = word.length;\n /*\n * If the word after first order prefix deletion is bigger than 2 and ends in either -kan, -an, or -i suffixes,\n * the suffix will be stemmed here. e.g. penyebaran - sebar.\n */\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeEnding(word, removeSuffixRules, removeSuffixExceptions, morphologyData);\n }\n /*\n * If the word previously had a suffix, we check further if the word after first order prefix and suffix deletion has more than 2 syllables.\n * If it does have more than 2 syllables and starts with one of the second order prefixes (i.e. ber-, be-, per-, pe-), the prefix will\n * be stemmed here unless the word is in the exception list of words with a beginning that looks like a second order prefix.\n */\n if (wordLength !== word.length && !doNotStemSecondOrderPrefix.includes(word)) {\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeSecondOrderPrefix(word, morphologyData);\n }\n }\n }\n return word;\n};\n\n/**\n * Stems Indonesian singular words.\n *\n * @param {string} word The singular word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stem of an Indonesian singular word.\n */\nconst stemSingular = function(word, morphologyData) {\n const singleSyllableWords = stemSingleSyllableWords(word, morphologyData);\n // Stem the single syllable words\n word = singleSyllableWords;\n\n const doNotStemParticle = morphologyData.stemming.doNotStemWords.doNotStemParticle;\n const doNotStemPronoun = morphologyData.stemming.doNotStemWords.doNotStemPronounSuffix;\n\n if (calculateTotalNumberOfSyllables(word) <= 2) {\n return word;\n }\n\n // Check if a word after its derivational affixes stemmed exists in the exception list.\n const firstDerivationalStem = stemDerivational(word, morphologyData);\n if (\n doNotStemParticle.includes(firstDerivationalStem) ||\n doNotStemPronoun.includes(firstDerivationalStem)\n ) {\n // If it does exist in the exception list, the ending that looks like a particle or a pronoun suffix should not be stemmed.\n return firstDerivationalStem;\n }\n\n /*\n * If the word has more than 2 syllables and ends in of the particle endings (i.e. -kah, -lah, -pun), stem the particle here.\n * e.g. bajumulah -> bajumu, bawalah -> bawa\n */\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeParticle,\n doNotStemParticle,\n morphologyData\n );\n\n // If the word (still) has more than 2 syllables and ends in of the possessive pronoun endings (i.e. -ku, -mu, -nya), stem the ending here.\n if (calculateTotalNumberOfSyllables(word) > 2) {\n // E.g. bajumu -> baju\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removePronoun,\n doNotStemPronoun,\n morphologyData\n );\n }\n\n // If the word (still) has more than 2 syllables and has derivational affixes, the affix(es) will be stemmed here.\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = stemDerivational(word, morphologyData);\n }\n return word;\n};\n\n/**\n * Stems Indonesian plural words.\n *\n * @param {string} word The plural word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string|null} The stem of an Indonesian plural word or null if no plural was detected.\n */\nconst stemPlural = function(word, morphologyData) {\n const hyphenIndex = word.indexOf('-');\n\n // If there is no hyphen in the word, it can't be a reduplicated plural.\n if (hyphenIndex === -1) {\n return null;\n }\n\n const splitWord = word.split('-');\n\n if (splitWord.length === 2) {\n let firstPart = splitWord[0];\n let secondPart = splitWord[1];\n\n firstPart = stemSingular(firstPart, morphologyData);\n secondPart = stemSingular(secondPart, morphologyData);\n\n /*\n * To compare the first and second part and see whether it's actually a reduplication:\n * Trim the beginning of the word since it might be variable due to stem changes caused by prefixes.\n * For example, in \"meniru-nirukan\" the singular stemmer will correctly stem the first \"niru\" to \"tiru\" because\n * of the prefix \"me\". Since the second part of the word is stemmed individually, there is no \"me\" and hence\n * \"niru\" remains \"niru\". To still be able to link these two forms to each other,\n * we compare the two parts of the word after stripping the variable first or first and second letter.\n *\n */\n const firstPartBeginningTrimmed = firstPart.substring(1);\n const secondPartBeginningTrimmed =\n secondPart.startsWith('ng') || secondPart.startsWith('ny')\n ? secondPart.substring(2)\n : secondPart.substring(1);\n\n if (firstPartBeginningTrimmed === secondPartBeginningTrimmed) {\n const nonPlurals = morphologyData.stemming.nonPluralReduplications;\n\n // Check non-plural reduplication.\n if (nonPlurals.includes(firstPart) && nonPlurals.includes(secondPart)) {\n /*\n * In words such as \"mengira-ngira\" prefix \"me\" causes a modification on both words (k->ng). This will\n * be correctly stemmed for the first word, but not the second. Therefore, the correct base form\n * \"kira-kira\" is created based on a reduplication of the correctly stemmed first part, \"kira\".\n */\n return firstPart + '-' + firstPart;\n }\n\n // Return the stemmed singular form of a reduplicated plural.\n return firstPart;\n }\n }\n\n return null;\n};\n\n/**\n * Stems Indonesian words\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stem of an Indonesian word.\n */\nexport default function stem(word, morphologyData) {\n // Check words that shouldn't receive any stemming.\n if (morphologyData.stemming.shouldNotBeStemmed.includes(word)) {\n return word;\n }\n\n const stemmedPlural = stemPlural(word, morphologyData);\n\n if (stemmedPlural) {\n return stemmedPlural;\n }\n\n word = stemSingular(word, morphologyData);\n\n return word;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AAFA,MAAM;EAACE,iBAAiB;EAAEC,aAAa;EAAEC;AAAqB,CAAC,GAAGC,yBAAkB;AAIpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG,SAAAA,CAASC,IAAI,EAAEC,aAAa,EAAE;EAClE,KAAK,MAAMC,MAAM,IAAID,aAAa,EAAE;IAClC,IAAID,IAAI,CAACG,KAAK,CAACD,MAAM,CAAC,EAAE;MACtB,OAAO,IAAI;IACb;EACF;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,+BAA+B,GAAG,SAAAA,CAASJ,IAAI,EAAEK,cAAc,EAAE;EACrE;EACA,IACEL,IAAI,C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em.js","names":["_index","require","_stemHelpers","flattenSortLength","buildFormRule","createRulesFromArrays","languageProcessing","checkSingleSyllableWordSuffix","word","suffixesArray","suffix","match","stemSingleSyllableWordsPrefixes","morphologyData","startsWith","checkBeginningsList","stemming","singleSyllableWords","substring","length","test","stemSingleSyllableWords","suffixCombination","singleSyllableWordsSuffixes","inputWord","some","shortWord","calculateTotalNumberOfSyllables","removeEnding","regexRules","removeParticle","doNotStemWords","doNotStemParticle","removePronoun","doNotStemPronounSuffix","wordWithoutDerivationalSuffix","removeSuffixes","doNotStemSuffix","includes","tryStemmingKeAndTer","terException","doNotStemPrefix","doNotStemFirstOrderPrefix","doNotStemTer","wordWithTer","beginningModification","rBeginning","replace","checkFirstOrderPrefixExceptions","nBeginning","kBeginning","pBeginning","mBeginning","wordAfterKeTerCheck","removeFirstOrderPrefix","firstOrderPrefixException","regex","removeFirstOrderPrefixes","withRemovedFirstOrderPrefix","removeSecondOrderPrefix","removeSecondOrderPrefixes","withRemovedSecondOrderPrefix","stemDerivational","wordLength","removeSuffixRules","removeSuffixExceptions","doNotStemSecondOrderPrefix","wordWithPrefixLookAlike","stemSingular","doNotStemPronoun","firstDerivationalStem","stemPlural","hyphenIndex","indexOf","splitWord","split","firstPart","secondPart","firstPartBeginningTrimmed","secondPartBeginningTrimmed","nonPlurals","nonPluralReduplications","stem","shouldNotBeStemmed","stemmedPlural"],"sources":["../../../../../../src/languageProcessing/languages/id/helpers/internal/stem.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {flattenSortLength, buildFormRule, createRulesFromArrays} = languageProcessing;\n\nimport {calculateTotalNumberOfSyllables, removeEnding, checkBeginningsList} from './stemHelpers';\n\n/**\n * MIT License\n *\n * Adapted from: Copyright (c) 2013 Adinda Praditya\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software\n * and associated documentation files (the \\\"Software\\\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n * THE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\"\n */\n\n/**\n * Checks if a single syllable word has one of the suffixes/suffix combination.\n *\n * @param {string} word The word to check.\n * @param {Array} suffixesArray The array of suffixes\n * @returns {boolean} Whether the word ends in one of the suffixes or not.\n */\nconst checkSingleSyllableWordSuffix = function(word, suffixesArray) {\n for (const suffix of suffixesArray) {\n if (word.match(suffix)) {\n return true;\n }\n }\n};\n\n/**\n * Stems the prefix of the single syllable words, i.e. di-/penge-/menge-\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string} The stemmed word.\n */\nconst stemSingleSyllableWordsPrefixes = function(word, morphologyData) {\n // If the word gets prefix di-, stem the prefix here. E.g. dicekkanlah -> cekkanlah, dibomi -> bomi\n if (\n word.startsWith('di') &&\n checkBeginningsList(word, 2, morphologyData.stemming.singleSyllableWords)\n ) {\n return word.substring(2, word.length);\n }\n /*\n * If the word gets prefix menge-/penge- and is followed by one of the words in the list, stem the prefix here.\n * E.g. pengeboman -> boman\n */\n if (\n /^[mp]enge/i.test(word) &&\n checkBeginningsList(word, 5, morphologyData.stemming.singleSyllableWords)\n ) {\n return word.substring(5, word.length);\n }\n return word;\n};\n\n/**\n * Stems Indonesian single syllable words. This function concerns single syllable words\n * with this possible word format [di/penge/menge] + single syllable word + [kan/an/i] + [ku/mu/nya] + [kah/lah/pun], with [] being optional.\n * E.g. dipel -> pel, dipelkan -> pel, dipelkanlah -> pel, pelkan -> pel, pelmulah -> pel, pengeboman -> bom, mengesahkan -> sah\n *\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string} The stemmed word.\n */\nconst stemSingleSyllableWords = function(word, morphologyData) {\n const singleSyllableWords = morphologyData.stemming.singleSyllableWords;\n const suffixCombination = morphologyData.stemming.singleSyllableWordsSuffixes;\n const inputWord = word;\n // If the word starts with prefix di-/penge-/menge-, stem the prefix here. E.g. pengeboman -> boman, dipelkan -> pelkan\n word = stemSingleSyllableWordsPrefixes(word, morphologyData);\n\n // Check if a word starts with one of the words in the list, has maximum 3 syllables, and ends in one of the single syllable suffixes\n if (\n singleSyllableWords.some(shortWord => word.startsWith(shortWord)) &&\n calculateTotalNumberOfSyllables(word) <= 3 &&\n checkSingleSyllableWordSuffix(word, suffixCombination)\n ) {\n // If the word gets a particle suffix, stem the particle. E.g. cekkanlah -> cekkan, pelkan -> pel, vasmulah -> vasmu\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeParticle,\n morphologyData.stemming.doNotStemWords.doNotStemParticle,\n morphologyData\n );\n\n // If the word gets a possessive pronoun suffix, stem the possessive pronoun. E.g. vasmu -> vas\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removePronoun,\n morphologyData.stemming.doNotStemWords.doNotStemPronounSuffix,\n morphologyData\n );\n\n // If the word ends in -kan/-an/-i suffix, stem the suffix. E.g. cekkan -> cek, bomi -> bom\n const wordWithoutDerivationalSuffix = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeSuffixes,\n morphologyData.stemming.doNotStemWords.doNotStemSuffix,\n morphologyData\n );\n\n if (singleSyllableWords.includes(wordWithoutDerivationalSuffix)) {\n word = wordWithoutDerivationalSuffix;\n }\n }\n /*\n * We only want to stem single syllable words here.\n * Thus, if the output word has more than one syllable, we don't stem the input word at all.\n */\n if (calculateTotalNumberOfSyllables(word) > 1 || word.length === 1) {\n word = inputWord;\n }\n return word;\n};\n\n/**\n * Tries stemming prefixes ke- and ter-. Ke- is always stemmed, and ter- only if it is a prefix and not part of the stem.\n * Also if the stem of the word begins with r-, only te- is stemmed, not ter-.\n *\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n * @param {string}\tword\t\t\tThe word to check.\n *\n * @returns {string|null}\tThe stem or null if the word did not start with ter/keter.\n */\nconst tryStemmingKeAndTer = function(morphologyData, word) {\n const terException =\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemFirstOrderPrefix.doNotStemTer;\n\n // If prefix -ter is preceded by prefix -ke, remove it first.\n if (word.startsWith('keter')) {\n word = word.substring(2, word.length);\n }\n if (word.startsWith('ter')) {\n // If word is on an exception list of words where -ter should not be stemmed, do not stem -ter and return the word.\n if (terException.some(wordWithTer => word.startsWith(wordWithTer))) {\n return word;\n }\n // If word (without prefixes) is on the list of words beginning with -r, remove only -te instead of -ter.\n if (checkBeginningsList(word, 3, morphologyData.stemming.beginningModification.rBeginning)) {\n return word.replace(/^ter/i, 'r');\n }\n // Otherwise, remove -ter.\n return word.substring(3, word.length);\n }\n};\n/**\n * Checks whether a word has a first order prefix and whether it is on an exception list of words which require a stem mofification\n * after removing the prefix. Returns the stem if the prefix was found and the word was matched on an exception list.\n *\n *\n * @param {string}\tword\t\t\tThe word to check.\n * @param {Object}\tmorphologyData\tThe Indonesian morphology data file.\n *\n * @returns {string|null}\tThe stem or null if a prefix was not found, or was found but the word was not on the exception list.\n */\nconst checkFirstOrderPrefixExceptions = function(word, morphologyData) {\n const beginningModification = morphologyData.stemming.beginningModification;\n\n // If a word starts with \"men\" or \"pen\" and is present in the nBeginning exception list, the prefix should be replaced with \"n\".\n if (/^[mp]en/i.test(word)) {\n if (checkBeginningsList(word, 3, beginningModification.nBeginning)) {\n return word.replace(/^[mp]en/i, 'n');\n }\n }\n if (/^[mp]eng/i.test(word) && checkBeginningsList(word, 4, beginningModification.kBeginning)) {\n return word.replace(/^[mp]eng/i, 'k');\n }\n\n if (/^[mp]em/i.test(word)) {\n if (checkBeginningsList(word, 3, beginningModification.pBeginning)) {\n return word.replace(/^(mem|pem)/i, 'p');\n } else if (checkBeginningsList(word, 3, beginningModification.mBeginning)) {\n return word.replace(/^(mem|pem)/i, 'm');\n }\n }\n // Stem prefix ke- if found. Stem te(r)- unless the word was found on the exception list of words with stem beginning in -ter.\n const wordAfterKeTerCheck = tryStemmingKeAndTer(morphologyData, word);\n if (wordAfterKeTerCheck) {\n return wordAfterKeTerCheck;\n }\n};\n\n/**\n * Stems the first-order prefix of a word based on regexRules. If the word is found in an exception list, implements a stem modification.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst removeFirstOrderPrefix = function(word, morphologyData) {\n // Checks whether the word has a first order prefix and requires a stem modification.\n const firstOrderPrefixException = checkFirstOrderPrefixExceptions(word, morphologyData);\n\n if (firstOrderPrefixException) {\n return firstOrderPrefixException;\n }\n const regex = createRulesFromArrays(morphologyData.stemming.regexRules.removeFirstOrderPrefixes);\n const withRemovedFirstOrderPrefix = buildFormRule(word, regex);\n\n return withRemovedFirstOrderPrefix || word;\n};\n\n/**\n * Stems the second-order prefix of a word based on regexRules. If the word is found in an exception list, implements a stem modification.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst removeSecondOrderPrefix = function(word, morphologyData) {\n // If a word starts with \"ber\" or \"per\" and is present in the rBeginning exception list, the prefix should be replaced with \"r\".\n if (\n (word.startsWith('ber') || word.startsWith('per')) &&\n checkBeginningsList(word, 3, morphologyData.stemming.beginningModification.rBeginning)\n ) {\n return word.replace(/^(ber|per)/i, 'r');\n }\n // If a word starts with a first order prefix followed by peng- and is in the kBeginning exception list, then peng- should be replaced with k.\n if (\n /^peng/i.test(word) &&\n checkBeginningsList(word, 4, morphologyData.stemming.beginningModification.kBeginning)\n ) {\n return word.replace(/^peng/i, 'k');\n }\n const regex = createRulesFromArrays(morphologyData.stemming.regexRules.removeSecondOrderPrefixes);\n const withRemovedSecondOrderPrefix = buildFormRule(word, regex);\n\n return withRemovedSecondOrderPrefix || word;\n};\n\n/**\n * Stems derivational affixes of Indonesian words.\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stemmed word.\n */\nconst stemDerivational = function(word, morphologyData) {\n let wordLength = word.length;\n const removeSuffixRules = morphologyData.stemming.regexRules.removeSuffixes;\n const removeSuffixExceptions = morphologyData.stemming.doNotStemWords.doNotStemSuffix;\n const doNotStemFirstOrderPrefix = flattenSortLength(\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemFirstOrderPrefix\n );\n const doNotStemSecondOrderPrefix = flattenSortLength(\n morphologyData.stemming.doNotStemWords.doNotStemPrefix.doNotStemSecondOrderPrefix\n );\n\n // If a word is in the list of words with a beginning that looks like a valid suffix, do not stem the suffix\n if (\n !doNotStemFirstOrderPrefix.some(wordWithPrefixLookAlike =>\n word.startsWith(wordWithPrefixLookAlike)\n )\n ) {\n /*\n * If the word has more than 2 syllables and starts with one of first order prefixes (i.e. meng-, meny-, men-, mem-, me-,\n * peng-, peny-, pen-, pem-, di-, ter-, ke- ), the prefix will be stemmed here. e.g. penyebaran -> sebaran, diperlebarkan -> perlebarkan\n */\n word = removeFirstOrderPrefix(word, morphologyData);\n }\n\n if (wordLength === word.length) {\n if (\n !doNotStemSecondOrderPrefix.some(wordWithPrefixLookAlike =>\n word.startsWith(wordWithPrefixLookAlike)\n )\n ) {\n /*\n * If the word does not start with one of the first order prefixes but starts with one of the second order prefixes,\n * the prefix will be stemmed here, e.g., peranakan -> anakan\n */\n word = removeSecondOrderPrefix(word, morphologyData);\n }\n // If the word has more than 2 syllables and ends in either -kan, -an, or -i suffixes, the suffix will be deleted here, e.g., anakan -> anak\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeEnding(word, removeSuffixRules, removeSuffixExceptions, morphologyData);\n }\n } else {\n // If the word previously had a first order prefix, assign wordLength to the length of the word after prefix deletion.\n wordLength = word.length;\n /*\n * If the word after first order prefix deletion is bigger than 2 and ends in either -kan, -an, or -i suffixes,\n * the suffix will be stemmed here. e.g. penyebaran - sebar.\n */\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeEnding(word, removeSuffixRules, removeSuffixExceptions, morphologyData);\n }\n /*\n * If the word previously had a suffix, we check further if the word after first order prefix and suffix deletion has more than 2 syllables.\n * If it does have more than 2 syllables and starts with one of the second order prefixes (i.e. ber-, be-, per-, pe-), the prefix will\n * be stemmed here unless the word is in the exception list of words with a beginning that looks like a second order prefix.\n */\n if (wordLength !== word.length && !doNotStemSecondOrderPrefix.includes(word)) {\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = removeSecondOrderPrefix(word, morphologyData);\n }\n }\n }\n return word;\n};\n\n/**\n * Stems Indonesian singular words.\n *\n * @param {string} word The singular word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stem of an Indonesian singular word.\n */\nconst stemSingular = function(word, morphologyData) {\n const singleSyllableWords = stemSingleSyllableWords(word, morphologyData);\n // Stem the single syllable words\n word = singleSyllableWords;\n\n const doNotStemParticle = morphologyData.stemming.doNotStemWords.doNotStemParticle;\n const doNotStemPronoun = morphologyData.stemming.doNotStemWords.doNotStemPronounSuffix;\n\n if (calculateTotalNumberOfSyllables(word) <= 2) {\n return word;\n }\n\n // Check if a word after its derivational affixes stemmed exists in the exception list.\n const firstDerivationalStem = stemDerivational(word, morphologyData);\n if (\n doNotStemParticle.includes(firstDerivationalStem) ||\n doNotStemPronoun.includes(firstDerivationalStem)\n ) {\n // If it does exist in the exception list, the ending that looks like a particle or a pronoun suffix should not be stemmed.\n return firstDerivationalStem;\n }\n\n /*\n * If the word has more than 2 syllables and ends in of the particle endings (i.e. -kah, -lah, -pun), stem the particle here.\n * e.g. bajumulah -> bajumu, bawalah -> bawa\n */\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removeParticle,\n doNotStemParticle,\n morphologyData\n );\n\n // If the word (still) has more than 2 syllables and ends in of the possessive pronoun endings (i.e. -ku, -mu, -nya), stem the ending here.\n if (calculateTotalNumberOfSyllables(word) > 2) {\n // E.g. bajumu -> baju\n word = removeEnding(\n word,\n morphologyData.stemming.regexRules.removePronoun,\n doNotStemPronoun,\n morphologyData\n );\n }\n\n // If the word (still) has more than 2 syllables and has derivational affixes, the affix(es) will be stemmed here.\n if (calculateTotalNumberOfSyllables(word) > 2) {\n word = stemDerivational(word, morphologyData);\n }\n return word;\n};\n\n/**\n * Stems Indonesian plural words.\n *\n * @param {string} word The plural word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string|null} The stem of an Indonesian plural word or null if no plural was detected.\n */\nconst stemPlural = function(word, morphologyData) {\n const hyphenIndex = word.indexOf('-');\n\n // If there is no hyphen in the word, it can't be a reduplicated plural.\n if (hyphenIndex === -1) {\n return null;\n }\n\n const splitWord = word.split('-');\n\n if (splitWord.length === 2) {\n let firstPart = splitWord[0];\n let secondPart = splitWord[1];\n\n firstPart = stemSingular(firstPart, morphologyData);\n secondPart = stemSingular(secondPart, morphologyData);\n\n /*\n * To compare the first and second part and see whether it's actually a reduplication:\n * Trim the beginning of the word since it might be variable due to stem changes caused by prefixes.\n * For example, in \"meniru-nirukan\" the singular stemmer will correctly stem the first \"niru\" to \"tiru\" because\n * of the prefix \"me\". Since the second part of the word is stemmed individually, there is no \"me\" and hence\n * \"niru\" remains \"niru\". To still be able to link these two forms to each other,\n * we compare the two parts of the word after stripping the variable first or first and second letter.\n *\n */\n const firstPartBeginningTrimmed = firstPart.substring(1);\n const secondPartBeginningTrimmed =\n secondPart.startsWith('ng') || secondPart.startsWith('ny')\n ? secondPart.substring(2)\n : secondPart.substring(1);\n\n if (firstPartBeginningTrimmed === secondPartBeginningTrimmed) {\n const nonPlurals = morphologyData.stemming.nonPluralReduplications;\n\n // Check non-plural reduplication.\n if (nonPlurals.includes(firstPart) && nonPlurals.includes(secondPart)) {\n /*\n * In words such as \"mengira-ngira\" prefix \"me\" causes a modification on both words (k->ng). This will\n * be correctly stemmed for the first word, but not the second. Therefore, the correct base form\n * \"kira-kira\" is created based on a reduplication of the correctly stemmed first part, \"kira\".\n */\n return firstPart + '-' + firstPart;\n }\n\n // Return the stemmed singular form of a reduplicated plural.\n return firstPart;\n }\n }\n\n return null;\n};\n\n/**\n * Stems Indonesian words\n *\n * @param {string} word The word to stem.\n * @param {Object} morphologyData The object that contains regex-based rules and exception lists for Indonesian stemming.\n *\n * @returns {string} The stem of an Indonesian word.\n */\nexport default function stem(word, morphologyData) {\n // Check words that shouldn't receive any stemming.\n if (morphologyData.stemming.shouldNotBeStemmed.includes(word)) {\n return word;\n }\n\n const stemmedPlural = stemPlural(word, morphologyData);\n\n if (stemmedPlural) {\n return stemmedPlural;\n }\n\n word = stemSingular(word, morphologyData);\n\n return word;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AAFA,MAAM;EAACE,iBAAiB;EAAEC,aAAa;EAAEC;AAAqB,CAAC,GAAGC,yBAAkB;AAIpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,6BAA6B,GAAG,SAAAA,CAASC,IAAI,EAAEC,aAAa,EAAE;EAClE,KAAK,MAAMC,MAAM,IAAID,aAAa,EAAE;IAClC,IAAID,IAAI,CAACG,KAA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EK,cAAc,CAAC;EAEtD,IAAIuE,aAAa,EAAE;IACjB,OAAOA,aAAa;EACtB;EAEA5E,IAAI,GAAG4D,YAAY,CAAC5D,IAAI,EAAEK,cAAc,CAAC;EAEzC,OAAOL,IAAI;AACb","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.calculateTotalNumberOfSyllables = calculateTotalNumberOfSyllables;
|
|
7
7
|
exports.checkBeginningsList = checkBeginningsList;
|
|
8
8
|
exports.removeEnding = removeEnding;
|
|
9
|
-
var _index = require("
|
|
9
|
+
var _index = require("../../../index");
|
|
10
10
|
const {
|
|
11
11
|
buildFormRule,
|
|
12
12
|
createRulesFromArrays
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stemHelpers.js","names":["_index","require","buildFormRule","createRulesFromArrays","languageProcessing","vowelCharacters","isVowel","character","includes","calculateTotalNumberOfSyllables","word","result","i","length","removeEnding","regexRules","exceptions","morphologyData","wordsWithKEnding","stemming","doNotStemWords","doNotStemK","endsWith","wordWithoutSuffixAn","substring","removePartRegex","withRemovedPart","checkBeginningsList","prefixLength","beginnings","wordWithoutPrefix","slice","some","beginning","startsWith"],"sources":["../../../../../../src/languageProcessing/languages/id/helpers/internal/stemHelpers.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"stemHelpers.js","names":["_index","require","buildFormRule","createRulesFromArrays","languageProcessing","vowelCharacters","isVowel","character","includes","calculateTotalNumberOfSyllables","word","result","i","length","removeEnding","regexRules","exceptions","morphologyData","wordsWithKEnding","stemming","doNotStemWords","doNotStemK","endsWith","wordWithoutSuffixAn","substring","removePartRegex","withRemovedPart","checkBeginningsList","prefixLength","beginnings","wordWithoutPrefix","slice","some","beginning","startsWith"],"sources":["../../../../../../src/languageProcessing/languages/id/helpers/internal/stemHelpers.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {buildFormRule, createRulesFromArrays} = languageProcessing;\n\nconst vowelCharacters = ['a', 'e', 'i', 'o', 'u'];\n\n/**\n * Determines if an input character is a vowel.\n *\n * @param {string} character The character to check.\n *\n * @returns {boolean} Whether the input character is an Indonesian vowel.\n */\nfunction isVowel(character) {\n return vowelCharacters.includes(character);\n}\n\n/**\n * Calculates the total number of syllables in the input word.\n *\n * @param {string} word The word to calculate the number of syllables in.\n *\n * @returns {int} The total number of syllables in the word.\n */\nexport function calculateTotalNumberOfSyllables(word) {\n let result = 0;\n\n for (let i = 0; i < word.length; i++) {\n if (isVowel(word[i])) {\n result++;\n }\n }\n\n return result;\n}\n\n/**\n * Stems the ending of a word based on some regexRules after checking if the word is in the exception list.\n *\n * @param {string} word The word to stem.\n * @param {Array} regexRules The list of regex-based rules to apply to the word in order to stem it.\n * @param {string[]} exceptions The list of words that should not get the ending removed.\n * @param {Object} morphologyData The Indonesian morphology data file\n *\n * @returns {string} The stemmed word.\n */\nexport function removeEnding(word, regexRules, exceptions, morphologyData) {\n if (exceptions.includes(word)) {\n return word;\n }\n\n // Check words ending in -kan whether they are words whose stem ending in -k that get suffix -an or not.\n const wordsWithKEnding = morphologyData.stemming.doNotStemWords.doNotStemK;\n if (word.endsWith('kan')) {\n const wordWithoutSuffixAn = word.substring(0, word.length - 2);\n // If a word has stem ending -k and gets suffix -an, then only stem -an here.\n if (wordsWithKEnding.includes(wordWithoutSuffixAn)) {\n word = wordWithoutSuffixAn;\n }\n }\n\n const removePartRegex = createRulesFromArrays(regexRules);\n const withRemovedPart = buildFormRule(word, removePartRegex);\n return withRemovedPart || word;\n}\n\n/**\n * Checks if the beginning of the word is present in an exception list.\n *\n * @param {string} word The word to stem.\n * @param {int} prefixLength The length of the prefix to be trimmed before checking in the list.\n * @param {string[]} beginnings The list of word beginnings that should be checked.\n *\n * @returns {boolean} Whether the word is found in the list with beginnings.\n */\nexport function checkBeginningsList(word, prefixLength, beginnings) {\n const wordWithoutPrefix = word.slice(prefixLength);\n return beginnings.some(beginning => wordWithoutPrefix.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,MAAME,eAAe,GAAGtB,qBAAqB,CAACY,UAAU,CAAC;EACzD,MAAMW,eAAe,GAAGxB,aAAa,CAACQ,IAAI,EAAEe,eAAe,CAAC;EAC5D,OAAOC,eAAe,IAAIhB,IAAI;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASiB,mBAAmBA,CAACjB,IAAI,EAAEkB,YAAY,EAAEC,UAAU,EAAE;EAClE,MAAMC,iBAAiB,GAAGpB,IAAI,CAACqB,KAAK,CAACH,YAAY,CAAC;EAClD,OAAOC,UAAU,CAACG,IAAI,CAACC,SAAS,IAAIH,iBAAiB,CAACI,UAAU,CAACD,SAAS,CAAC,CAAC;AAC9E","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = isPassiveSentence;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _nonPassiveVerbsStartingDi = _interopRequireDefault(require("../config/internal/nonPassiveVerbsStartingDi"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_nonPassiveVerbsStartingDi","_interopRequireDefault","e","__esModule","default","getWords","languageProcessing","passivePrefix","isPassiveSentence","sentence","words","toLowerCase","matchedPassives","filter","word","length","startsWith","nonPassive","nonPassives","matchedPassive","matchedPassivesShouldStay","passiveIndex","indexOf","wordPrecedingPassive"],"sources":["../../../../../src/languageProcessing/languages/id/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"isPassiveSentence.js","names":["_index","require","_nonPassiveVerbsStartingDi","_interopRequireDefault","e","__esModule","default","getWords","languageProcessing","passivePrefix","isPassiveSentence","sentence","words","toLowerCase","matchedPassives","filter","word","length","startsWith","nonPassive","nonPassives","matchedPassive","matchedPassivesShouldStay","passiveIndex","indexOf","wordPrecedingPassive"],"sources":["../../../../../src/languageProcessing/languages/id/helpers/isPassiveSentence.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {getWords} = languageProcessing;\n\nimport nonPassives from '../config/internal/nonPassiveVerbsStartingDi';\nconst passivePrefix = 'di';\n\n/**\n * Checks the passed sentence to see if it contains Indonesian passive verb-forms.\n *\n * @param {string} sentence The sentence to match against.\n *\n * @returns {Boolean} Whether the sentence contains Indonesian passive voice.\n */\nexport default function isPassiveSentence(sentence) {\n const words = getWords(sentence.toLowerCase());\n let matchedPassives = words.filter(word => word.length > 4);\n matchedPassives = matchedPassives.filter(word => word.startsWith(passivePrefix));\n if (matchedPassives.length === 0) {\n return false;\n }\n\n // Check exception list.\n for (const nonPassive of nonPassives) {\n matchedPassives = matchedPassives.filter(word => !word.startsWith(nonPassive));\n }\n\n // Check direct precedence exceptions.\n matchedPassives = matchedPassives.filter(function(matchedPassive) {\n let matchedPassivesShouldStay = true;\n const passiveIndex = words.indexOf(matchedPassive);\n const wordPrecedingPassive = words[passiveIndex - 1];\n if (wordPrecedingPassive === 'untuk') {\n matchedPassivesShouldStay = false;\n }\n return matchedPassivesShouldStay;\n });\n\n return matchedPassives.length !== 0;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,0BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuE,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFvE,MAAM;EAACG;AAAQ,CAAC,GAAGC,yBAAkB;AAGrC,MAAMC,aAAa,GAAG,IAAI;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,iBAAiBA,CAACC,QAAQ,EAAE;EAClD,MAAMC,KAAK,GAAGL,QAAQ,CAACI,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC;EAC9C,IAAIC,eAAe,GAAGF,KAAK,CAACG,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,MAAM,GAAG,CAAC,CAAC;EAC3DH,eAAe,GAAGA,eAAe,CAACC,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACE,UAAU,CAACT,aAAa,CAAC,CAAC;EAChF,IAAIK,eAAe,CAACG,MAAM,KAAK,CAAC,EAAE;IAChC,OAAO,KAAK;EACd;;EAEA;EACA,KAAK,MAAME,UAAU,IAAIC,kCAAW,EAAE;IACpCN,eAAe,GAAGA,eAAe,CAACC,MAAM,CAACC,IAAI,IAAI,CAACA,IAAI,CAACE,UAAU,CAACC,UAAU,CAAC,CAAC;EAChF;;EAEA;EACAL,eAAe,GAAGA,eAAe,CAACC,MAAM,CAAC,UAASM,cAAc,EAAE;IAChE,IAAIC,yBAAyB,GAAG,IAAI;IACpC,MAAMC,YAAY,GAAGX,KAAK,CAACY,OAAO,CAACH,cAAc,CAAC;IAClD,MAAMI,oBAAoB,GAAGb,KAAK,CAACW,YAAY,GAAG,CAAC,CAAC;IACpD,IAAIE,oBAAoB,KAAK,OAAO,EAAE;MACpCH,yBAAyB,GAAG,KAAK;IACnC;IACA,OAAOA,yBAAyB;EAClC,CAAC,CAAC;EAEF,OAAOR,eAAe,CAACG,MAAM,KAAK,CAAC;AACrC","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _firstWordExceptions = _interopRequireDefault(require("./config/firstWordExceptions"));
|
|
9
9
|
var _functionWords = require("./config/functionWords");
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("./config/stopWords"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_stopWords","_transitionWords","_twoPartTransitionWords","_syllables","_sentenceLength","_getClauses","_getStemmer","_calculateFleschReadingScore","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","stopWords","transitionWords","twoPartTransitionWords","syllables","sentenceLength","helpers","getClauses","getStemmer","fleschReadingScore","exports"],"sources":["../../../../src/languageProcessing/languages/it/Researcher.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"Researcher.js","names":["_index","require","_firstWordExceptions","_interopRequireDefault","_functionWords","_stopWords","_transitionWords","_twoPartTransitionWords","_syllables","_sentenceLength","_getClauses","_getStemmer","_calculateFleschReadingScore","e","__esModule","default","AbstractResearcher","languageProcessing","Researcher","constructor","paper","Object","assign","config","language","passiveConstructionType","firstWordExceptions","functionWords","stopWords","transitionWords","twoPartTransitionWords","syllables","sentenceLength","helpers","getClauses","getStemmer","fleschReadingScore","exports"],"sources":["../../../../src/languageProcessing/languages/it/Researcher.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {AbstractResearcher} = languageProcessing;\n\n// All config\nimport firstWordExceptions from './config/firstWordExceptions';\nimport {all as functionWords} from './config/functionWords';\nimport stopWords from './config/stopWords';\nimport transitionWords from './config/transitionWords';\nimport twoPartTransitionWords from './config/twoPartTransitionWords';\nimport syllables from './config/syllables.json';\nimport sentenceLength from './config/sentenceLength';\n\n// All helpers\nimport getClauses from './helpers/getClauses';\nimport getStemmer from './helpers/getStemmer';\nimport fleschReadingScore from './helpers/calculateFleschReadingScore';\n\n/**\n * The researcher contains all the researches, helpers, data, and config.\n */\nexport default class Researcher extends AbstractResearcher {\n /**\n * Constructor\n * @param {Paper} paper The Paper object that is needed within the researches.\n * @constructor\n */\n constructor(paper) {\n super(paper);\n\n Object.assign(this.config, {\n language: 'it',\n passiveConstructionType: 'periphrastic',\n firstWordExceptions,\n functionWords,\n stopWords,\n transitionWords,\n twoPartTransitionWords,\n syllables,\n sentenceLength\n });\n\n Object.assign(this.helpers, {\n getClauses,\n getStemmer,\n fleschReadingScore\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,gBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,uBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AAGA,IAAAS,WAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,WAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,4BAAA,GAAAT,sBAAA,CAAAF,OAAA;AAAuE,SAAAE,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAdvE,MAAM;EAACG;AAAkB,CAAC,GAAGC,yBAAkB;;AAE/C;;AASA;;AAKA;AACA;AACA;AACe,MAAMC,UAAU,SAASF,kBAAkB,CAAC;EACzD;AACF;AACA;AACA;AACA;EACEG,WAAWA,CAACC,KAAK,EAAE;IACjB,KAAK,CAACA,KAAK,CAAC;IAEZC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACC,MAAM,EAAE;MACzBC,QAAQ,EAAE,IAAI;MACdC,uBAAuB,EAAE,cAAc;MACvCC,mBAAmB,EAAnBA,4BAAmB;MACnBC,aAAa,EAAbA,kBAAa;MACbC,SAAS,EAATA,kBAAS;MACTC,eAAe,EAAfA,wBAAe;MACfC,sBAAsB,EAAtBA,+BAAsB;MACtBC,SAAS,EAATA,kBAAS;MACTC,cAAc,EAAdA;IACF,CAAC,CAAC;IAEFX,MAAM,CAACC,MAAM,CAAC,IAAI,CAACW,OAAO,EAAE;MAC1BC,UAAU,EAAVA,mBAAU;MACVC,UAAU,EAAVA,mBAAU;MACVC,kBAAkB,EAAlBA;IACF,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAAtB,OAAA,GAAAG,UAAA","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getItalianClauses;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _Clause = _interopRequireDefault(require("../values/Clause"));
|
|
9
9
|
var _passiveVoiceAuxiliaries = _interopRequireDefault(require("../config/internal/passiveVoiceAuxiliaries.js"));
|
|
10
10
|
var _stopWords = _interopRequireDefault(require("../config/stopWords.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_passiveVoiceAuxiliaries","_stopWords","e","__esModule","default","createRegexFromArray","getClauses","languageProcessing","followingAuxiliaryExceptionWords","reflexivePronouns","options","Clause","stopwords","auxiliaries","regexes","auxiliaryRegex","stopCharacterRegex","followingAuxiliaryExceptionRegex","directPrecedenceExceptionRegex","getItalianClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/it/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getClauses.js","names":["_index","require","_Clause","_interopRequireDefault","_passiveVoiceAuxiliaries","_stopWords","e","__esModule","default","createRegexFromArray","getClauses","languageProcessing","followingAuxiliaryExceptionWords","reflexivePronouns","options","Clause","stopwords","auxiliaries","regexes","auxiliaryRegex","stopCharacterRegex","followingAuxiliaryExceptionRegex","directPrecedenceExceptionRegex","getItalianClauses","sentence"],"sources":["../../../../../src/languageProcessing/languages/it/helpers/getClauses.js"],"sourcesContent":["import {languageProcessing} from '../../../index';\nconst {createRegexFromArray, getClauses} = languageProcessing;\n\nimport Clause from '../values/Clause';\nimport auxiliaries from '../config/internal/passiveVoiceAuxiliaries.js';\nimport stopwords from '../config/stopWords.js';\n\nconst followingAuxiliaryExceptionWords = ['il', 'i', 'la', 'le', 'lo', 'gli', 'uno', 'una'];\nconst reflexivePronouns = ['mi', 'ti', 'si', 'ci', 'vi'];\n\nconst options = {\n Clause,\n stopwords: stopwords,\n auxiliaries: auxiliaries,\n regexes: {\n auxiliaryRegex: createRegexFromArray(auxiliaries),\n stopCharacterRegex: /([:,])(?=[ \\n\\r\\t'\"+\\-»«‹›<>])/gi,\n followingAuxiliaryExceptionRegex: createRegexFromArray(followingAuxiliaryExceptionWords),\n directPrecedenceExceptionRegex: createRegexFromArray(reflexivePronouns)\n }\n};\n\n/**\n * Gets the clauses from a sentence by determining sentence breakers.\n *\n * @param {string} sentence The sentence to split up in clauses.\n *\n * @returns {Array} The array with all the clauses that have an auxiliary.\n */\nexport default function getItalianClauses(sentence) {\n return getClauses(sentence, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA+C,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAJ/C,MAAM;EAACG,oBAAoB;EAAEC;AAAU,CAAC,GAAGC,yBAAkB;AAM7D,MAAMC,gCAAgC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AAC3F,MAAMC,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAExD,MAAMC,OAAO,GAAG;EACdC,MAAM,EAANA,eAAM;EACNC,SAAS,EAAEA,kBAAS;EACpBC,WAAW,EAAEA,gCAAW;EACxBC,OAAO,EAAE;IACPC,cAAc,EAAEV,oBAAoB,CAACQ,gCAAW,CAAC;IACjDG,kBAAkB,EAAE,kCAAkC;IACtDC,gCAAgC,EAAEZ,oBAAoB,CAACG,gCAAgC,CAAC;IACxFU,8BAA8B,EAAEb,oBAAoB,CAACI,iBAAiB;EACxE;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASU,iBAAiBA,CAACC,QAAQ,EAAE;EAClD,OAAOd,UAAU,CAACc,QAAQ,EAAEV,OAAO,CAAC;AACtC","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getStemmer;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
|
-
var _index = require("
|
|
8
|
+
var _index = require("../../../index");
|
|
9
9
|
var _stem = _interopRequireDefault(require("./internal/stem"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/it/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '
|
|
1
|
+
{"version":3,"file":"getStemmer.js","names":["_lodash","require","_index","_stem","_interopRequireDefault","e","__esModule","default","baseStemmer","languageProcessing","getStemmer","researcher","morphologyData","get","getData","word","stem"],"sources":["../../../../../src/languageProcessing/languages/it/helpers/getStemmer.js"],"sourcesContent":["import {get} from 'lodash';\nimport {languageProcessing} from '../../../index';\nconst {baseStemmer} = languageProcessing;\n\nimport stem from './internal/stem';\n\n/**\n * Returns the stemmer for a researcher.\n *\n * @param {Researcher} researcher The researcher.\n *\n * @returns {Function} The stemmer.\n */\nexport default function getStemmer(researcher) {\n const morphologyData = get(researcher.getData('morphology'), 'it', false);\n\n if (morphologyData) {\n return word => stem(word, morphologyData);\n }\n\n return baseStemmer;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAmC,SAAAG,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAFnC,MAAM;EAACG;AAAW,CAAC,GAAGC,yBAAkB;AAIxC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAACC,UAAU,EAAE;EAC7C,MAAMC,cAAc,GAAG,IAAAC,WAAG,EAACF,UAAU,CAACG,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;EAEzE,IAAIF,cAAc,EAAE;IAClB,OAAOG,IAAI,IAAI,IAAAC,aAAI,EAACD,IAAI,EAAEH,cAAc,CAAC;EAC3C;EAEA,OAAOJ,WAAW;AACpB","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = getParticiples;
|
|
7
|
-
var _index = require("
|
|
7
|
+
var _index = require("../../../index");
|
|
8
8
|
var _passiveVoiceParticiples = _interopRequireDefault(require("../../config/internal/passiveVoiceParticiples"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
const {
|