diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-06 12:48:30 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-07-06 12:48:30 +0200 |
| commit | 8ff994ab8419a243b051a07feabefdad3a4e1e3b (patch) | |
| tree | 4740c130995c328b93dfc7cf2115780298f37b10 /src/dictionary.rs | |
| parent | 5d5079d1838221ddac71154037dd15f138ee6460 (diff) | |
add cli
Diffstat (limited to 'src/dictionary.rs')
| -rw-r--r-- | src/dictionary.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dictionary.rs b/src/dictionary.rs index a8d9b28..b522c9e 100644 --- a/src/dictionary.rs +++ b/src/dictionary.rs @@ -31,8 +31,8 @@ impl Dictionary { } } - pub fn get(&self, name : String) -> u64 { - *self.data.get(&name).unwrap() + pub fn get(&self, name : String) -> Option<&u64> { + self.data.get(&name) } pub fn iter(&self) -> &HashMap<String, u64> { @@ -55,7 +55,7 @@ impl Dictionary { let mut fv = FileVector::new(); for word in words { - let i = self.get(word); + let i = *self.get(word).unwrap(); if !fv.contains_key(&i) { fv.insert(i, 1); } else { |