Skip to content

Commit

Permalink
use pinyin-data v0.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Dec 12, 2021
1 parent 8096a1f commit b76daca
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.9.0] (2021-12-11)

* 使用 [pinyin-data] v0.12.0 的拼音数据


## [0.8.0] (2020-06-13)

Expand Down Expand Up @@ -124,3 +128,4 @@
[0.6.0]: https://github.com/mozillazg/rust-pinyin/compare/v0.5.0...v0.6.0
[0.7.0]: https://github.com/mozillazg/rust-pinyin/compare/v0.6.0...v0.7.0
[0.8.0]: https://github.com/mozillazg/rust-pinyin/compare/v0.7.0...v0.8.0
[0.9.0]: https://github.com/mozillazg/rust-pinyin/compare/v0.8.0...v0.9.0
6 changes: 3 additions & 3 deletions src/pinyin_multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ pub trait ToPinyinMulti {
/// let mut iter = '还'.to_pinyin_multi().unwrap().into_iter();
/// let mut next_pinyin = || iter.next().map(Pinyin::with_tone);
/// assert_eq!(next_pinyin(), Some("hái"));
/// assert_eq!(next_pinyin(), Some("fú"));
/// assert_eq!(next_pinyin(), Some("huán"));
/// assert_eq!(next_pinyin(), Some("fú"));
/// assert_eq!(next_pinyin(), None);
/// # }
/// ```
Expand Down Expand Up @@ -110,7 +110,7 @@ impl ToPinyinMulti for char {
/// .and_then(|m| m)
/// .map(|m| m.into_iter().map(Pinyin::with_tone).collect::<Vec<_>>())
/// };
/// assert_eq!(next_heteronym(), Some(vec!["hái", "", "huán"]));
/// assert_eq!(next_heteronym(), Some(vec!["hái", "huán", ""]));
/// assert_eq!(next_heteronym(), Some(vec!["méi", "mò", "me"]));
/// assert_eq!(next_heteronym(), None);
/// # }
Expand Down Expand Up @@ -194,7 +194,7 @@ mod tests {
.collect::<Vec<_>>()
})
.collect::<Vec<_>>();
let expected = vec![vec!["hái", "", "huán"], vec!["méi", "mò", "me"]];
let expected = vec![vec!["hái", "huán", ""], vec!["méi", "mò", "me"]];
assert_eq!(actual, expected);
}
}
2 changes: 1 addition & 1 deletion tests/pinyin/b.txt-plain
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ chu,men,kan,huo,ban,-,huo,ban,jie,jing,huang,-
-,tong,xing,shi,er,nian,-,bu,zhi,mu,lan,shi,nü,lang,-,-

xiong,tu,jiao,pu,shuo,-,ci,tu,yan,mi,li,-
liang,tu,bang,de,zou,-,an,neng,bian,wo,shi,xiong,ci,-
liang,tu,bang,di,zou,-,an,neng,bian,wo,shi,xiong,ci,-
2 changes: 1 addition & 1 deletion tests/pinyin/b.txt-with_tone
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ chū,mén,kàn,huǒ,bàn,-,huǒ,bàn,jiē,jīng,huáng,-
-,tóng,xíng,shí,èr,nián,-,bù,zhī,mù,lán,shì,nǚ,láng,-,-

xióng,tù,jiǎo,pū,shuò,-,cí,tù,yǎn,mí,lí,-
liǎng,tù,bàng,de,zǒu,-,ān,néng,biàn,wǒ,shì,xióng,cí,-
liǎng,tù,bàng,,zǒu,-,ān,néng,biàn,wǒ,shì,xióng,cí,-
2 changes: 1 addition & 1 deletion tests/pinyin/b.txt-with_tone_num
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ chu1,me2n,ka4n,huo3,ba4n,-,huo3,ba4n,jie1,ji1ng,hua2ng,-
-,to2ng,xi2ng,shi2,e4r,nia2n,-,bu4,zhi1,mu4,la2n,shi4,nü3,la2ng,-,-

xio2ng,tu4,jia3o,pu1,shuo4,-,ci2,tu4,ya3n,mi2,li2,-
lia3ng,tu4,ba4ng,de,zo3u,-,a1n,ne2ng,bia4n,wo3,shi4,xio2ng,ci2,-
lia3ng,tu4,ba4ng,di4,zo3u,-,a1n,ne2ng,bia4n,wo3,shi4,xio2ng,ci2,-
2 changes: 1 addition & 1 deletion tests/pinyin/b.txt-with_tone_num_end
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ chu1,men2,kan4,huo3,ban4,-,huo3,ban4,jie1,jing1,huang2,-
-,tong2,xing2,shi2,er4,nian2,-,bu4,zhi1,mu4,lan2,shi4,nü3,lang2,-,-

xiong2,tu4,jiao3,pu1,shuo4,-,ci2,tu4,yan3,mi2,li2,-
liang3,tu4,bang4,de,zou3,-,an1,neng2,bian4,wo3,shi4,xiong2,ci2,-
liang3,tu4,bang4,di4,zou3,-,an1,neng2,bian4,wo3,shi4,xiong2,ci2,-
4 changes: 2 additions & 2 deletions tests/special_pinyin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use pinyin::ToPinyinMulti;
fn special_pinyin() {
assert_eq!(
list_all_heteronym('欸'),
&["ai1", "ai3", "xie4", "ê2", "ei2", "ê3", "ei3", "ê4", "ei4", "ê1", "ei1"],
&["ai1", "ai3", "ê1", "ê2", "ê3", "ê4", "xie4", "ei2", "ei3", "ei4", "ei1"],
);
assert_eq!(list_all_heteronym('嘸'), &["fu3", "wu3", "m1", "m2"]);
assert_eq!(list_all_heteronym('呣'), &["m2", "mou2", "m4"]);
assert_eq!(list_all_heteronym('呣'), &["m2", "m4", "mou2"]);
}

fn list_all_heteronym(ch: char) -> Vec<&'static str> {
Expand Down

0 comments on commit b76daca

Please sign in to comment.