Rename sentence_score() to score_sentence()
This commit is contained in:
parent
62f5b79d6d
commit
c21b66ab83
|
@ -95,11 +95,11 @@ impl Segmenter {
|
|||
///
|
||||
/// Returns the relative probability for the given sentence in the the corpus represented by
|
||||
/// this `Segmenter`. Will return `None` iff given an empty iterator argument.
|
||||
fn sentence_score(&self, words: &PyIterator) -> PyResult<Option<f64>> {
|
||||
fn score_sentence(&self, words: &PyIterator) -> PyResult<Option<f64>> {
|
||||
let words = words
|
||||
.map(|s| s?.extract::<&str>())
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
Ok(self.inner.sentence_score(words.into_iter()))
|
||||
Ok(self.inner.score_sentence(words.into_iter()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Segmenter {
|
|||
///
|
||||
/// Returns the relative probability for the given sentence in the the corpus represented by
|
||||
/// this `Segmenter`. Will return `None` iff given an empty iterator argument.
|
||||
pub fn sentence_score<'a>(&self, mut words: impl Iterator<Item = &'a str>) -> Option<f64> {
|
||||
pub fn score_sentence<'a>(&self, mut words: impl Iterator<Item = &'a str>) -> Option<f64> {
|
||||
let mut prev = words.next()?;
|
||||
let mut score = self.score(prev, None);
|
||||
while let Some(word) = words.next() {
|
||||
|
|
Loading…
Reference in New Issue