Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Dirty tracking and 'withTokens' API #4

Merged
merged 1 commit into from

2 participants

@hotwoofy

I've had to move around some of the dirty-tracking to be able to just work with the trainWithTokens and guessWithTokens methods. I'm doing my own tokenization externally and noticed nothing was ever getting a score.

@lok lok merged commit 013a317 into lok:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/BKClassifier.m
View
4 src/BKClassifier.m
@@ -277,7 +277,6 @@ - (void)trainWithString:(NSString*)trainString forPoolNamed:(NSString*)poolName
NSArray *tokens = [tokenizer tokenizeString:trainString];
BKDataPool *pool = [self poolNamed:poolName];
[self trainWithTokens:tokens inPool:pool];
- dirty = YES;
}
- (void)trainWithTokens:(NSArray*)tokens inPool:(BKDataPool*)pool
@@ -287,6 +286,7 @@ - (void)trainWithTokens:(NSArray*)tokens inPool:(BKDataPool*)pool
[pool increaseCountForToken:token];
[corpus increaseCountForToken:token];
}
+ dirty = YES;
}
#pragma mark -
@@ -307,12 +307,12 @@ - (NSDictionary*)guessWithFile:(NSString*)path
- (NSDictionary*)guessWithString:(NSString*)string
{
NSArray *tokens = [tokenizer tokenizeString:string];
- [self updatePoolsProbabilities];
return [self guessWithTokens:tokens];
}
- (NSDictionary*)guessWithTokens:(NSArray*)tokens
{
+ [self updatePoolsProbabilities];
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:[pools count]];
for (NSString *poolName in pools) {
Something went wrong with that request. Please try again.