Skip to content

Commit

Permalink
Merge pull request #1 from sotch-pr35mac/pw/prioritize_simplified
Browse files Browse the repository at this point in the history
Changed dictionary priority to simplified from traditional
  • Loading branch information
sotch-pr35mac authored May 5, 2020
2 parents e6753db + ae6ca34 commit cef1350
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.1] - 2020-05-05
### Changed
- Changed dictionary priority from traditional to simplified

## [0.1.0] - 2020-05-05
Initial Release
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chinese_segmenter"
version = "0.1.0"
version = "0.1.1"
authors = ["Preston Wang-Stosur-Bassett <[email protected]>"]
description = "Tokenize Chinese sentences using a dictionary-driven largest first matching approach."
repository = "https://github.com/sotch-pr35mac/chinese_segmenter"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# segmenter
##### v0.1.0
##### v0.1.1
---

### About
Expand Down
2 changes: 1 addition & 1 deletion src/chinese_segmenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Segmenter {
let default_take = if raw.len() < 20 { raw.len() } else { 20 };
let mut skip = 0;
let mut take = default_take;
let dictionary = if self.converter.is_traditional(raw.to_string()) { &self.traditional } else { &self.simplified };
let dictionary = if self.converter.is_simplified(raw.to_string()) { &self.simplified } else { &self.traditional };

while skip < raw.chars().count() {
let substring: String = raw.chars().skip(skip).take(take).collect();
Expand Down

0 comments on commit cef1350

Please sign in to comment.