当前位置: 首页>>代码示例>>Python>>正文


Python config.RasaNLUConfig方法代码示例

本文整理汇总了Python中rasa_nlu.config.RasaNLUConfig方法的典型用法代码示例。如果您正苦于以下问题:Python config.RasaNLUConfig方法的具体用法?Python config.RasaNLUConfig怎么用?Python config.RasaNLUConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rasa_nlu.config的用法示例。


在下文中一共展示了config.RasaNLUConfig方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def parse(self, message):
        interpreter = Interpreter.load(nlu_model_path, RasaNLUConfig("../mom/nlu_model_config.json"))
        intent = interpreter.parse(message)
        return intent
        # return {
        #     "text": message,
        #     "intent": {"name": intent, "confidence": 1.0},
        #     "entities": []
        # } 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:11,代码来源:train_online.py

示例2: train

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def train():
    training_data = load_data('../mom/data/nlu.json')
    trainer = Trainer(RasaNLUConfig("../mom/nlu_model_config.json"))
    trainer.train(training_data)
    model_directory = trainer.persist('../models')  # Returns the directory the model is stored in
    return model_directory 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:8,代码来源:train_nlu.py

示例3: predict

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def predict(model_directory):
    from rasa_nlu.model import Metadata, Interpreter
    # where `model_directory points to the folder the model is persisted in
    interpreter = Interpreter.load(model_directory, RasaNLUConfig("../mom/nlu_model_config.json"))
    print (interpreter.parse("salad"))

# model_directory = train()
# print (model_directory) 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:10,代码来源:train_nlu.py

示例4: parse

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def parse(self, message):
        interpreter = Interpreter.load(nlu_model_path, RasaNLUConfig("../mom/nlu_model_config.json"))
        intent = interpreter.parse(message)
        return intent 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:6,代码来源:test.py

示例5: train_babi_nlu

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def train_babi_nlu():
    training_data = load_data('examples/babi/data/franken_data.json')
    trainer = Trainer(RasaNLUConfig("examples/babi/data/config_nlu.json"))
    trainer.train(training_data)
    model_directory = trainer.persist('examples/babi/models/nlu/',
                                      fixed_model_name=model_name)
    return model_directory 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:9,代码来源:train_nlu.py

示例6: parse

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def parse(self, text):
        """Parses a text message.

        Returns a nlu value if the parsing of the text failed."""

        if self.lazy_init and self.interpreter is None:
            from rasa_nlu.model import Interpreter
            from rasa_nlu.config import RasaNLUConfig
            self.interpreter = Interpreter.load(self.metadata,
                                                RasaNLUConfig(self.config_file,
                                                              os.environ))
        return self.interpreter.parse(text) 
开发者ID:Rowl1ng,项目名称:rasa_wechat,代码行数:14,代码来源:interpreter.py

示例7: train

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def train(self, training_data, config, **kwargs):
        # type: (TrainingData, RasaNLUConfig, **Any) -> None
        if config['language'] != 'zh':
            raise Exception("tokenizer_yaha is only used for Chinese. Check your configure json file.")
            
        for example in training_data.training_examples:
            example.set("tokens", self.tokenize(example.text)) 
开发者ID:crownpku,项目名称:Rasa_NLU_Chi,代码行数:9,代码来源:yaha_tokenizer.py

示例8: __init__

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def __init__(self):
        self.rasa_config = RasaNLUConfig(self.config_file)
        self.trainer = Trainer(self.rasa_config, self.builder) 
开发者ID:Cyberjusticelab,项目名称:JusticeAI,代码行数:5,代码来源:rasa_classifier.py

示例9: __init__

# 需要导入模块: from rasa_nlu import config [as 别名]
# 或者: from rasa_nlu.config import RasaNLUConfig [as 别名]
def __init__(self, data_provider, config_file, data_file, model_dir):
		logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s')

		# store unparsed messages, so later we can train bot
		self.unparsed_messages = []

		self.data_provider = data_provider
		self.data_file = data_file
		self.model_dir = model_dir
		self.rasa_config = RasaNLUConfig(config_file) 
开发者ID:plutov,项目名称:bot,代码行数:12,代码来源:rasa.py


注:本文中的rasa_nlu.config.RasaNLUConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。