Skip to content

Commit 0a953b5

Browse files
Update
1 parent df35781 commit 0a953b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+709
-554
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ env:
4040
- DEADLINKS_VERS=0.3.0
4141
- RUSTFLAGS="-C link-dead-code"
4242
- RUST_LOG=off
43-
- TARPAULIN_VERS=0.6.8
43+
- TARPAULIN_VERS=0.7.0
4444

4545
install:
4646
- cargo install --list
@@ -52,7 +52,7 @@ script: skip
5252
jobs:
5353
include:
5454
- stage: test
55-
rust: 1.27.0
55+
rust: 1.31.0
5656
script:
5757
- cargo test --verbose --all -- --test-threads=1
5858

@@ -106,7 +106,7 @@ jobs:
106106
- cargo clippy -- -D warnings
107107

108108
- stage: quality
109-
rust: nightly-2018-11-18
109+
rust: nightly-2019-01-29
110110
env:
111111
- FEATURE=cov
112112
install:

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ readme = "README.md"
1010
homepage = "https://github.com/irbis-labs/rsmorphy"
1111
repository = "https://github.com/irbis-labs/rsmorphy"
1212
documentation = "https://docs.rs/rsmorphy/"
13+
edition = "2018"
1314
publish = true
1415

1516
[badges]
@@ -41,9 +42,10 @@ serde = "1.0"
4142
serde_derive = "1.0"
4243
serde_json = "1.0"
4344
string_cache = "0.7"
44-
unicode_categories = "0.1"
45+
uc = { version = "0.1", package = "unicode_categories" }
4546

46-
rsmorphy-dict-ru = { version = "0.1", path = "./dict/ru" }
47+
dict-ru = { version = "0.1", package = "rsmorphy-dict-ru", path = "./dict/ru" }
48+
#dict-uk = { version = "0.1", package = "rsmorphy-dict-uk", path = "./dict/uk" }
4749

4850

4951
[dev-dependencies]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
[![Build Status](https://travis-ci.org/irbis-labs/rsmorphy.svg)](https://travis-ci.org/irbis-labs/rsmorphy)
55
[![Coverage Status](https://coveralls.io/repos/github/irbis-labs/rsmorphy/badge.svg?branch=master)](https://coveralls.io/github/irbis-labs/rsmorphy?branch=master)
6-
![Minimal rust version 1.27](https://img.shields.io/badge/rustc-1.27+-green.svg)
7-
![Nightly rust version from August 25, 2018](https://img.shields.io/badge/rustc-nightly_2018--08--25-yellow.svg)
6+
![Minimal rust version 1.32](https://img.shields.io/badge/rustc-1.32+-green.svg)
7+
![Nightly rust version from August 25, 2018](https://img.shields.io/badge/rustc-nightly_2019--01--29-yellow.svg)
88

99
[![Join the chat at https://gitter.im/rsmorphy/Lobby](https://badges.gitter.im/rsmorphy/Lobby.svg)](https://gitter.im/rsmorphy/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1010
[![Waffle.io - Columns and their card count](https://badge.waffle.io/irbis-labs/rsmorphy.svg?columns=inbox,backlog,in%20progress,done)](https://waffle.io/irbis-labs/rsmorphy)

dict/ru/build.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,7 @@ fn main() -> io::Result<()> {
1111
let mut f = File::create("src/release.rs")
1212
.expect("Can't create a file");
1313

14-
let res = Command::new("rustc")
15-
.arg("--version")
16-
.output()
17-
.expect("Can't get rustc version");
18-
19-
let version = from_utf8(&res.stdout)
20-
.expect("Can't convert from utf-8");
21-
22-
writeln!(f, r"pub static RUSTC_VERSION: &str = {:?};", version)
23-
.expect("Can't write to a file");
24-
25-
writeln!(f, r"pub const DICT_PATH: &str = {:?};", dict_path)
26-
.expect("Can't write to a file");
14+
writeln!(f, r"pub const DICT_PATH: &str = {:?};", dict_path)?;
2715

2816
Ok(())
2917
}

examples/enc-dec.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
extern crate rsmorphy;
22

3-
use rsmorphy::{prelude::*, rsmorphy_dict_ru};
3+
use dict_ru;
4+
use rsmorphy::prelude::*;
45

56
pub mod util;
67

7-
use util::print_row_parsed;
8+
use crate::util::print_row_parsed;
89

910
fn table(morph: &MorphAnalyzer, s: &str) {
1011
for (i, parsed) in morph.parse(s).into_iter().enumerate() {
@@ -22,7 +23,7 @@ fn table(morph: &MorphAnalyzer, s: &str) {
2223
}
2324

2425
fn main() {
25-
let morph_ru = MorphAnalyzer::from_file(rsmorphy_dict_ru::DICT_PATH);
26+
let morph_ru = MorphAnalyzer::from_file(dict_ru::DICT_PATH);
2627

2728
// table(&morph_ru, "яблоко");
2829
// table(&morph_ru, "хлеб");

examples/inflect.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
extern crate rsmorphy;
22

3-
use rsmorphy::{prelude::*, rsmorphy_dict_ru};
3+
use dict_ru;
4+
use rsmorphy::prelude::*;
45

56
pub mod util;
67

78
//use util::print_row_lex;
89

910
fn main() {
10-
let morph_ru = MorphAnalyzer::from_file(rsmorphy_dict_ru::DICT_PATH);
11+
let morph_ru = MorphAnalyzer::from_file(dict_ru::DICT_PATH);
1112

1213
//let lex = Lex::from_id(&morph_ru, "ru:d:стали,388,4").unwrap();
1314
//print_row_lex(&morph_ru, 0, &lex.inflect(&morph_ru, &GrammemeSet::from_str("plur,ablt")).unwrap());

examples/lexeme.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ extern crate rsmorphy;
33
use std::collections::BTreeSet;
44
use std::iter::FromIterator;
55

6-
use rsmorphy::{prelude::*, rsmorphy_dict_ru};
6+
use dict_ru;
7+
use rsmorphy::prelude::*;
78

89
pub mod util;
910

10-
use util::{input_loop, print_row_lex};
11+
use crate::util::{input_loop, print_row_lex};
1112

1213
fn print_lexeme(morph: &MorphAnalyzer, lex: &Lex) {
1314
for (i, lex) in lex.iter_lexeme(morph).enumerate() {
@@ -30,7 +31,7 @@ fn list(morph: &MorphAnalyzer, s: &str) {
3031
}
3132

3233
fn main() {
33-
let morph_ru = MorphAnalyzer::from_file(rsmorphy_dict_ru::DICT_PATH);
34+
let morph_ru = MorphAnalyzer::from_file(dict_ru::DICT_PATH);
3435

3536
input_loop(|word| list(&morph_ru, word));
3637
}

examples/parse.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
//extern crate rustyline;
22
extern crate rsmorphy;
33

4-
use rsmorphy::{prelude::*, rsmorphy_dict_ru};
4+
use dict_ru;
5+
use rsmorphy::prelude::*;
56

67
pub mod util;
78

8-
use util::{input_loop, print_row_parsed};
9+
use crate::util::{input_loop, print_row_parsed};
910

1011
fn table(morph: &MorphAnalyzer, s: &str) {
1112
for (i, parsed) in morph.parse(s).into_iter().enumerate() {
@@ -14,7 +15,7 @@ fn table(morph: &MorphAnalyzer, s: &str) {
1415
}
1516

1617
fn main() {
17-
let morph_ru = MorphAnalyzer::from_file(rsmorphy_dict_ru::DICT_PATH);
18+
let morph_ru = MorphAnalyzer::from_file(dict_ru::DICT_PATH);
1819

1920
input_loop(|word| table(&morph_ru, word))
2021
}

src/analyzer/morph.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use std::path::Path;
22

3-
use container::{ParseResult, SeenSet};
4-
use opencorpora::dictionary::Dictionary;
5-
6-
use analyzer::units::*;
7-
use estimator::SingleTagProbabilityEstimator;
3+
use crate::{
4+
analyzer::units::*,
5+
container::{ParseResult, SeenSet},
6+
estimator::SingleTagProbabilityEstimator,
7+
opencorpora::dictionary::Dictionary,
8+
};
89

910
#[derive(Debug, Default, Clone)]
1011
pub struct Units {
@@ -107,10 +108,11 @@ impl MorphAnalyzer {
107108
#[cfg(test)]
108109
mod tests {
109110
use env_logger;
110-
use {rsmorphy_dict_ru, MorphAnalyzer};
111111

112-
lazy_static! {
113-
static ref RU: MorphAnalyzer = MorphAnalyzer::from_file(rsmorphy_dict_ru::DICT_PATH);
112+
use crate::MorphAnalyzer;
113+
114+
lazy_static::lazy_static! {
115+
static ref RU: MorphAnalyzer = MorphAnalyzer::from_file(dict_ru::DICT_PATH);
114116
}
115117

116118
#[test]

src/analyzer/units/abbr/initials.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
use std::borrow::Cow;
2-
use std::collections::BTreeSet;
3-
use std::iter::FromIterator;
1+
use std::{borrow::Cow, collections::BTreeSet, iter::FromIterator};
42

5-
use analyzer::units::abc::AnalyzerUnit;
6-
use analyzer::MorphAnalyzer;
7-
use container::stack::StackSource;
8-
use container::{Initials, InitialsKind};
9-
use container::{Lex, Score};
10-
use container::{ParseResult, Parsed, SeenSet};
11-
use opencorpora::OpencorporaTagReg;
3+
use crate::{
4+
analyzer::{units::abc::AnalyzerUnit, MorphAnalyzer},
5+
container::{
6+
stack::StackSource, Initials, InitialsKind, Lex, ParseResult, Parsed, Score, SeenSet,
7+
},
8+
opencorpora::OpencorporaTagReg,
9+
};
1210

13-
lazy_static! {
11+
lazy_static::lazy_static! {
1412
#[derive(Debug)]
1513
pub static ref LETTERS: BTreeSet<&'static str> = {
1614
let set = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯ".split("").filter(|v| !v.is_empty());
@@ -63,13 +61,13 @@ impl AnalyzerUnit for InitialsAnalyzer {
6361
word_lower: &str,
6462
_seen_parses: &mut SeenSet,
6563
) {
66-
trace!("AbbreviatedFirstNameAnalyzer::parse()");
67-
trace!(r#" word: "{}", word_lower: "{}" "#, word, word_lower);
68-
trace!(
64+
log::trace!("AbbreviatedFirstNameAnalyzer::parse()");
65+
log::trace!(r#" word: "{}", word_lower: "{}" "#, word, word_lower);
66+
log::trace!(
6967
r#" LETTERS: "{:?}" "#,
7068
LETTERS.iter().cloned().collect::<Vec<&str>>().join(", ")
7169
);
72-
trace!(r#" LETTERS contains word: "{}" "#, LETTERS.contains(word));
70+
log::trace!(r#" LETTERS contains word: "{}" "#, LETTERS.contains(word));
7371

7472
if let Some(&letter) = LETTERS.get(word) {
7573
for (tag_idx, &(_, kind)) in self.tags.iter().enumerate() {

0 commit comments

Comments
 (0)