LoginSignup
1
1

More than 3 years have passed since last update.

Watson Discovery Serviceのコレクションに登録できるトレーニングデータの文字数制限

Posted at

IBM Watson™ Discovery サービスのトレーニングについて

Watson Discoveryサービスのトレーニングの詳細についてはチュートリアルを参照してください。

ツールを使用した結果関連性の改善
API を使用した結果関連性の改善

IBM Watson™ Discovery サービスでトレーニングを使用して、自然言語照会の関連性を改善することができます。 Discovery ツールまたは Discovery API のいずれかを使用して、プライベート・コレクションをトレーニングすることができます。

トレーニングデータの文字数制限

Watson Discoveryサービスのコレクションに学習させる自然言語のトレーニングデータには以下の文字数制限とトークン数の制限があります。両方とも満たしている必要があるため、片方が制限に達した場合はそこでトレーニングデータが切れることになります。

文字数制限:2048文字
トークン数:約250トークン

また、日本語、英語、簡体中国語、韓国語のトレーニングデータにおいて、いずれも上記の制限があります。

トークンの制限について

Watson Discoveryサービスのトレーニングデータには形態素解析エンジンによってトークン化されます。日本語のトレーニングデータを使うことを前提に、APIを使用してトレーニングさせる場合などには、kuromojiなどを使用してトークン数をカウントして制限内でおさまるようにするなどして実装することが考えられます。

実装例

wds.js
   const kuromoji = require('kuromoji');
   const util = require('util');
   const builder = kuromoji.builder({
        dicPath: 'node_modules/kuromoji/dict'
    });
    const builderAsync = util.promisify(builder.build).bind(builder);
    const tokenizer = await builderAsync();
    const tokens = tokenizer.tokenize(text);
    if(tokens.length > 250){
        text = text.substr(0, tokens[250].word_position);
        console.log('Reduced to 250 tokens (because long text causes Error)\nfaq_id: %s, %s',faqId, text);
    }

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1