Skip to content

Commit a2708ce

Browse files
committed
- export BKG, ngrams to return all n-grams for all orders with truncated_start=false
1 parent d459717 commit a2708ce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/features.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ function ngrams(words::Array; order = 2, truncated_start = false)
6262
ret = String[]
6363

6464
if !truncated_start
65-
for wi = 1:min(order - 1, length(words))
66-
push!(ret, make_string(words, 1, wi))
65+
for o = 1:min(order - 1, length(words))
66+
for wi = 1:length(words)-(o-1)
67+
push!(ret, make_string(words, wi, wi + o - 1))
68+
end
6769
end
6870
end
6971

src/models.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1717
# See the License for the specific language governing permissions and
1818
# limitations under the License.
19-
export make_background, stats, vocab_size, apply
19+
export make_background, stats, vocab_size, apply, BKG
2020

2121
type BKG
2222
dict :: Associative{String, Int32}

0 commit comments

Comments
 (0)