eyo-kernel
Advanced tools
Comparing version 2.4.0 to 2.5.0
# Changelog | ||
## v2.5.0 | ||
- Поддержка комментариев в словарях. | ||
- Возможность указать для слова только строчное использование. | ||
- Исправлены ошибки из hcodes/eyo#24 | ||
## v2.4.0 | ||
@@ -4,0 +9,0 @@ Поддержка словарей сжатых с помощью `gzip` (`*.txt.gz`) #8. |
@@ -122,9 +122,14 @@ 'use strict'; | ||
} | ||
/** | ||
* Добавляет слово в словарь. | ||
* | ||
* @param {string} word | ||
* @param {string} rawWord | ||
*/ | ||
addWord(word) { | ||
addWord(rawWord) { | ||
let word = rawWord; | ||
if (rawWord.search('#') > -1) { | ||
word = word.split('#')[0].trim(); | ||
} | ||
if (word.search(/\(/) > -1) { | ||
@@ -141,2 +146,7 @@ const parts = word.split(/[(|)]/); | ||
_addWord(word) { | ||
// Слово может использоваться только со строчной буквы. | ||
// Пример: _киёв. Киев и только киёв. | ||
const hasUnderscore = word.search('_') === 0; | ||
word = word.replace(/^_/, ''); | ||
const key = this._replaceYo(word); | ||
@@ -146,3 +156,3 @@ | ||
if (word.search(/^[А-ЯЁ]/) === -1) { | ||
if (word.search(/^[А-ЯЁ]/) === -1 && !hasUnderscore) { | ||
this._dict[this._capitalize(key)] = this._capitalize(word); | ||
@@ -149,0 +159,0 @@ } |
{ | ||
"name": "eyo-kernel", | ||
"description": "Restoring the letter «ё» (yo) in russian texts", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"author": { | ||
@@ -36,3 +36,3 @@ "name": "Denis Seleznev", | ||
"chai": "^4.1.2", | ||
"eslint": "^5.0.1", | ||
"eslint": "^5.5.0", | ||
"istanbul": "^0.4.5", | ||
@@ -42,3 +42,4 @@ "mocha": "^5.2.0" | ||
"scripts": { | ||
"test": "npm run-script eslint && npm run-script unit-test-coverage", | ||
"gzip": "node ./tools/gzip.js", | ||
"test": "npm run gzip && npm run-script eslint && npm run-script unit-test-coverage", | ||
"eslint": "eslint .", | ||
@@ -45,0 +46,0 @@ "unit-test": "./node_modules/.bin/mocha -u bdd -R spec --recursive test", |
@@ -63,2 +63,3 @@ Восстановление буквы «ё» в русских текстах | ||
А слова, начинающиеся с заглавной буквы, заменят в тексте слова только с заглавной буквы (Еж → Ёж). | ||
Для комментариев используйте символ `#`. | ||
@@ -65,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118122
298
80