當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。