diff options
author | Peng Wu <alexepico@gmail.com> | 2012-10-20 16:26:02 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2012-10-20 16:26:37 +0800 |
commit | 2d42f29d97bcab3707365fdaa6df6920b2430ccb (patch) | |
tree | 7f5c0fc036f8eba180cf090cffe5587b1547ff37 /utils | |
parent | 60265e9a6bcc58bcaec8dc07611f2c30371c2165 (diff) | |
download | libpinyin-2d42f29d97bcab3707365fdaa6df6920b2430ccb.tar.gz libpinyin-2d42f29d97bcab3707365fdaa6df6920b2430ccb.tar.xz libpinyin-2d42f29d97bcab3707365fdaa6df6920b2430ccb.zip |
move get_first_token to spseg
Diffstat (limited to 'utils')
-rw-r--r-- | utils/segment/spseg.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/segment/spseg.cpp b/utils/segment/spseg.cpp index b7d6176..6205369 100644 --- a/utils/segment/spseg.cpp +++ b/utils/segment/spseg.cpp @@ -26,6 +26,21 @@ #include "pinyin_internal.h" #include "utils_helper.h" +/* for compatibility. */ +int get_first_token(PhraseTokens tokens, + /* out */ phrase_token_t & token){ + token = null_token; + + GArray * tokenarray = g_array_new(FALSE, FALSE, sizeof(phrase_token_t)); + int num = reduce_tokens(tokens, tokenarray); + if (num) + token = g_array_index(tokenarray, phrase_token_t, 0); + g_array_free(tokenarray, TRUE); + + return num; +} + + /* graph shortest path sentence segment. */ /* Note: |