在 rasa 中训练模型后查找表不起作用

dpe*_*per 3 rasa-nlu rasa-core rasa

我是拉萨的新手。我正在训练一个模型来使用查找表识别某些实体。我在一个句子中有多个实体,我正在尝试提取它们。

nlu.yml

version: "2.0"
nlu:
- intent: intent_1
  examples : |
    - how many deaths were there last year in [Ohio](Filter-State)?
    - death count of [Florida](Filter-State) this year
    - death count of [Texas](Filter-State) this year
    - what's the death count for this quarter in [CA](Filter-State)?
- lookup: Filter-State
  examples: |
    - Alabama
    - AL
    - Alaska
    - AK
    - Arizona
    - AZ
    - Arkansas
    - AR
    - California
    - CA
    - Colorado
    - CO
    - Connecticut
    - CT
    - Delaware
    - DE
    - District of Columbia
    - DC
    - Florida
    - FL
    - Georgia
    - GA
Run Code Online (Sandbox Code Playgroud)

配置.yml

language: en
pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: "char_wb"
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 150
    random_seed: 1
  - name: FallbackClassifier
    threshold: 0.7
  - name: DucklingEntityExtractor
    url: http://duckling.rasa.com:8000
    dimensions:
    - email
    - time
  - name: EntitySynonymMapper
policies:
  - name: AugmentedMemoizationPolicy
    max_history: 4
  - name: TEDPolicy
    max_history: 4
    epochs: 100
  - name: RulePolicy
    core_fallback_threshold: 0.4
    core_fallback_action_name: "action_default_fallback"
    enable_fallback_prediction: True
Run Code Online (Sandbox Code Playgroud)

当我训练模型并尝试使用 api 时,它无法识别查找表中状态的情况,因此无法将其分配给槽 filter_state。

谁能告诉我我在使查找表工作方面做错了什么!

小智 7

我是 Rasa 的新手,正在寻找另一个问题,但昨晚我刚刚遇到并解决了这个问题。

为了使查找表正常工作,您需要将“RegexEntityExtractor”添加到管道中,并可能删除 RegexFeaturizer。您还需要在 RegexEntityExtractor 配置中启用查找表。

配置.yml

pipeline:
   - name: WhitespaceTokenizer
   - name: LexicalSyntacticFeaturizer
   - name: CountVectorsFeaturizer

   - name: RegexEntityExtractor
     case_sensitive: False
     use_lookup_tables: True
     use_regexes: True
...
Run Code Online (Sandbox Code Playgroud)