Rasa NLU 实践

文章目录

    • 1. 目录结构
    • 2. nlu.yml
    • 3. config.yml
    • 4. domain.yml
    • 5. 实践

learn from https://github.com/Chinese-NLP-book/rasa_chinese_book_code

1. 目录结构

在这里插入图片描述

2. nlu.yml

version: "3.0"
nlu:- intent: greetexamples: |- 你好- hello- hi-- 在么- intent: goodbyeexamples: |- 拜拜- 再见-- 退出- 结束- intent: medicineexamples: |- [感冒](disease)了该吃什么药-[便秘](disease)了,该吃什么药-[胃痛](disease),该吃什么药- 一直[打喷嚏](disease)吃什么药好- 父母都有[高血压](disease),我应该推荐他们吃什么药好呢- 头上烫烫的,感觉[发烧](disease)了,该吃什么药好- [减肥](disease)有什么好的药品推荐吗?- intent: medical_departmentexamples: |- [感冒](disease)了该吃去哪个科室看病-[便秘](disease)了,该去挂哪个科室的号-[胃痛](disease),该去医院看哪个门诊啊- 一直[打喷嚏](disease)挂哪一个科室的号啊- [头疼](disease)该挂哪科- intent: medical_hospitalexamples: |- 我生病了,不知道去哪里看病- [减肥](disease)有什么好的医院或者健康中心推荐吗?- 想做个[体检](disease),有哪家医院或者哪里的诊所或者健康中心比较实惠啊?- 父母都有[高血压](disease),我应该推荐他们去哪家医院好呢

这个配置文件里面有一些 对话的意图,以及一些 该意图可能的说话例子

3. config.yml

recipe: default.v1language: zhpipeline:- name: JiebaTokenizer- name: LanguageModelFeaturizermodel_name: bertmodel_weights: bert-base-chinese- name: "DIETClassifier"epochs: 100policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
#   - name: MemoizationPolicy
#   - name: RulePolicy
#   - name: UnexpecTEDIntentPolicy
#     max_history: 5
#     epochs: 100
#   - name: TEDPolicy
#     max_history: 5
#     epochs: 100
#     constrain_similarities: true

这个文件里配置了:语种,分词器,模型、训练epochs等参数

4. domain.yml

version: "3.0"intents:- greet- goodbye- medicine- medical_department- medical_hospital

这个文件里面有所有的意图的类别

5. 实践

pip install --no-deps -r full_requirements.txt
cd Chapter02/
  • rasa train nlu 训练
rasa train nlu
┌────────────────────────────────────────────────────────────────────────────────┐
│ Rasa Open Source reports anonymous usage telemetry to help improve the product │
│ for all its users.                                                             │
│                                                                                │
│ If you'd like to opt-out, you can use `rasa telemetry disable`.                │
│ To learn more, check out https://rasa.com/docs/rasa/telemetry/telemetry.       │
└────────────────────────────────────────────────────────────────────────────────┘
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py:22: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative usesimport imp
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:23: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.'nearest': pil_image.NEAREST,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:24: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.'bilinear': pil_image.BILINEAR,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:25: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.'bicubic': pil_image.BICUBIC,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:28: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.if hasattr(pil_image, 'HAMMING'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:30: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.if hasattr(pil_image, 'BOX'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:33: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.if hasattr(pil_image, 'LANCZOS'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/matplotlib/__init__.py:169: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.if LooseVersion(module.__version__) < minver:
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.other = LooseVersion(other)
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/tensorflow_addons/utils/ensure_tf_install.py:47: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.min_version = LooseVersion(INCLUSIVE_MIN_TF_VERSION)
2022-11-07 10:00:26 INFO     transformers.file_utils  - TensorFlow version 2.6.5 available.
2022-11-07 10:00:27 INFO     rasa.engine.training.hooks  - Starting to train component 'JiebaTokenizer'.
2022-11-07 10:00:27 INFO     rasa.engine.training.hooks  - Finished training component 'JiebaTokenizer'.
Building prefix dict from the default dictionary ...
Dumping model to file cache /tmp/jieba.cache
Loading model cost 0.675 seconds.
Prefix dict has been built successfully.
Downloading: 100%|████████████████████████████████████████████████████████████████████████| 110k/110k [00:00<00:00, 250kB/s]
2022-11-07 10:00:30 INFO     transformers.tokenization_utils  - loading file https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-vocab.txt from cache at /home/web/.cache/torch/transformers/8a0c070123c1f794c42a29c6904beb7c1b8715741e235bee04aca2c7636fc83f.9b42061518a39ca00b8b52059fd2bede8daa613f8a8671500e518a8c29de8c00
Downloading: 100%|██████████████████████████████████████████████████████████████████████████| 624/624 [00:00<00:00, 613kB/s]
2022-11-07 10:00:32 INFO     transformers.configuration_utils  - loading configuration file https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-config.json from cache at /home/web/.cache/torch/transformers/8a3b1cfe5da58286e12a0f5d7d182b8d6eca88c08e26c332ee3817548cf7e60a.f12a4f986e43d8b328f5b067a641064d67b91597567a06c7b122d1ca7dfd9741
2022-11-07 10:00:32 INFO     transformers.configuration_utils  - Model config BertConfig {"architectures": ["BertForMaskedLM"],"attention_probs_dropout_prob": 0.1,"directionality": "bidi","hidden_act": "gelu","hidden_dropout_prob": 0.1,"hidden_size": 768,"initializer_range": 0.02,"intermediate_size": 3072,"layer_norm_eps": 1e-12,"max_position_embeddings": 512,"model_type": "bert","num_attention_heads": 12,"num_hidden_layers": 12,"pad_token_id": 0,"pooler_fc_size": 768,"pooler_num_attention_heads": 12,"pooler_num_fc_layers": 3,"pooler_size_per_head": 128,"pooler_type": "first_token_transform","type_vocab_size": 2,"vocab_size": 21128
}Downloading: 100%|████████████████████████████████████████████████████████████████████████| 478M/478M [17:05<00:00, 466kB/s]
2022-11-07 10:17:41 INFO     transformers.modeling_tf_utils  - loading weights file https://cdn.huggingface.co/bert-base-chinese-tf_model.h5 from cache at /home/web/.cache/torch/transformers/86a460b592673bcac3fe5d858ecf519e4890b4f6eddd1a46a077bd672dee6fe5.e6b974f59b54219496a89fd32be7afb020374df0976a796e5ccd3a1733d31537.h5
2022-11-07 10:17:43 INFO     transformers.modeling_tf_utils  - Layers from pretrained model not used in TFBertModel: ['nsp___cls', 'mlm___cls']
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/rasa/shared/nlu/training_data/features.py:152: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.f_as_text = self.features.tostring()
2022-11-07 10:17:44 INFO     rasa.engine.training.hooks  - Starting to train component 'DIETClassifier'.
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/rasa/utils/train_utils.py:527: UserWarning: constrain_similarities is set to `False`. It is recommended to set it to `True` when using cross-entropy loss.rasa.shared.utils.io.raise_warning(
Epochs: 100%|██████████████████████████████████████████████| 100/100 [00:31<00:00,  3.15it/s, t_loss=0.458, i_acc=1, e_f1=1]
2022-11-07 10:18:16 INFO     rasa.engine.training.hooks  - Finished training component 'DIETClassifier'.
Your Rasa model is trained and saved at 'models/nlu-20221107-100026-rainy-gazebo.tar.gz'.

模型被保存了

ll models/
total 39536
-rw-rw-r-- 1 web web 20238663 Nov  7 10:18 nlu-20221107-100026-rainy-gazebo.tar.gz
-rw-rw-r-- 1 web web 20238659 Nov 10 09:55 nlu-20221110-095458-green-trill.tar.gz
  • 运行测试 rasa shell nlu
rasa shell nlu
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/future/standard_library/__init__.py:65: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative usesimport imp
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:23: DeprecationWarning: NEAREST is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.NEAREST or Dither.NONE instead.'nearest': pil_image.NEAREST,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:24: DeprecationWarning: BILINEAR is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BILINEAR instead.'bilinear': pil_image.BILINEAR,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:25: DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.'bicubic': pil_image.BICUBIC,
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:28: DeprecationWarning: HAMMING is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.HAMMING instead.if hasattr(pil_image, 'HAMMING'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:30: DeprecationWarning: BOX is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BOX instead.if hasattr(pil_image, 'BOX'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/keras_preprocessing/image/utils.py:33: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.if hasattr(pil_image, 'LANCZOS'):
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/matplotlib/__init__.py:169: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.if LooseVersion(module.__version__) < minver:
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.other = LooseVersion(other)
/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/tensorflow_addons/utils/ensure_tf_install.py:47: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.min_version = LooseVersion(INCLUSIVE_MIN_TF_VERSION)
2022-11-10 09:57:48 INFO     rasa.core.processor  - Loading model models/nlu-20221110-095458-green-trill.tar.gz...
2022-11-10 09:57:50 INFO     transformers.tokenization_utils  - loading file https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-vocab.txt from cache at /home/web/.cache/torch/transformers/8a0c070123c1f794c42a29c6904beb7c1b8715741e235bee04aca2c7636fc83f.9b42061518a39ca00b8b52059fd2bede8daa613f8a8671500e518a8c29de8c00
2022-11-10 09:57:50 INFO     transformers.configuration_utils  - loading configuration file https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-chinese-config.json from cache at /home/web/.cache/torch/transformers/8a3b1cfe5da58286e12a0f5d7d182b8d6eca88c08e26c332ee3817548cf7e60a.f12a4f986e43d8b328f5b067a641064d67b91597567a06c7b122d1ca7dfd9741
2022-11-10 09:57:50 INFO     transformers.configuration_utils  - Model config BertConfig {"architectures": ["BertForMaskedLM"],"attention_probs_dropout_prob": 0.1,"directionality": "bidi","hidden_act": "gelu","hidden_dropout_prob": 0.1,"hidden_size": 768,"initializer_range": 0.02,"intermediate_size": 3072,"layer_norm_eps": 1e-12,"max_position_embeddings": 512,"model_type": "bert","num_attention_heads": 12,"num_hidden_layers": 12,"pad_token_id": 0,"pooler_fc_size": 768,"pooler_num_attention_heads": 12,"pooler_num_fc_layers": 3,"pooler_size_per_head": 128,"pooler_type": "first_token_transform","type_vocab_size": 2,"vocab_size": 21128
}2022-11-10 09:57:52 INFO     transformers.modeling_tf_utils  - loading weights file https://cdn.huggingface.co/bert-base-chinese-tf_model.h5 from cache at /home/web/.cache/torch/transformers/86a460b592673bcac3fe5d858ecf519e4890b4f6eddd1a46a077bd672dee6fe5.e6b974f59b54219496a89fd32be7afb020374df0976a796e5ccd3a1733d31537.h5
2022-11-10 09:57:57 INFO     transformers.modeling_tf_utils  - Layers from pretrained model not used in TFBertModel: ['nsp___cls', 'mlm___cls']/opt/bdp/data01/anaconda3/envs/rasa/lib/python3.8/site-packages/rasa/utils/train_utils.py:527: UserWarning: constrain_similarities is set to `False`. It is recommended to set it to `True` when using cross-entropy loss.rasa.shared.utils.io.raise_warning(
NLU model loaded. Type a message and press enter to parse it.
Next message:

测试1:

Next message:
我有点感冒,吃什么药好呢?
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.585 seconds.
Prefix dict has been built successfully.
{"text": "我有点感冒,吃什么药好呢?","intent": {"name": "medicine","confidence": 0.9998257756233215},"entities": [{"entity": "disease","start": 3,"end": 5,"confidence_entity": 0.9954996705055237,"value": "感冒","extractor": "DIETClassifier"}],"text_tokens": [[0,1],[1,3],[3,5],[5,6],[6,7],[7,9],[9,11],[11,12],[12,13]],"intent_ranking": [{"name": "medicine","confidence": 0.9998257756233215},{"name": "medical_department","confidence": 0.0001144336347351782},{"name": "medical_hospital","confidence": 2.84777233900968e-05},{"name": "goodbye","confidence": 2.1356245269998908e-05},{"name": "greet","confidence": 9.92826244328171e-06}]
}
Next message:
我有点晕,该看什么医生?
{"text": "我有点晕,该看什么医生?","intent": {"name": "medicine","confidence": 0.7516889572143555},"entities": [],"text_tokens": [[0,1],[1,3],[3,4],[4,5],[5,6],[6,7],[7,9],[9,11],[11,12]],"intent_ranking": [{"name": "medicine","confidence": 0.7516889572143555},{"name": "medical_department","confidence": 0.23077963292598724},{"name": "medical_hospital","confidence": 0.014110525138676167},{"name": "goodbye","confidence": 0.0021244173403829336},{"name": "greet","confidence": 0.0012964475899934769}]
}
Next message:
早上好
{"text": "早上好","intent": {"name": "greet","confidence": 0.9996402263641357},"entities": [],"text_tokens": [[0,3]],"intent_ranking": [{"name": "greet","confidence": 0.9996402263641357},{"name": "medical_department","confidence": 0.00014932868361938745},{"name": "goodbye","confidence": 0.00014898570952937007},{"name": "medical_hospital","confidence": 5.417354987002909e-05},{"name": "medicine","confidence": 7.281645139300963e-06}]
}
Next message:
人民医院在哪里
{"text": "人民医院在哪里","intent": {"name": "medical_hospital","confidence": 0.541263997554779},"entities": [],"text_tokens": [[0,2],[2,4],[4,5],[5,7]],"intent_ranking": [{"name": "medical_hospital","confidence": 0.541263997554779},{"name": "medical_department","confidence": 0.2764747440814972},{"name": "greet","confidence": 0.16937503218650818},{"name": "goodbye","confidence": 0.011964843608438969},{"name": "medicine","confidence": 0.0009213921148329973}]
}
  • 稍微添加点 nlu.yml,加了些赞美的例子
version: "3.0"
nlu:- intent: praiseexamples: |- 你真有才华- 你真帅气- 你好棒啊

重新训练 rasa train nlu
测试 rasa shell nlu

Next message:
你很优雅的完成了任务
{"text": "你很优雅的完成了任务","intent": {"name": "praise","confidence": 0.3122938573360443},"entities": [],"text_tokens": [[0,1],[1,2],[2,4],[4,5],[5,7],[7,8],[8,10]],"intent_ranking": [{"name": "praise","confidence": 0.3122938573360443},{"name": "medical_hospital","confidence": 0.24623937904834747},{"name": "goodbye","confidence": 0.20737841725349426},{"name": "medicine","confidence": 0.19506700336933136},{"name": "medical_department","confidence": 0.020120976492762566},{"name": "greet","confidence": 0.018900321796536446}]
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/470838.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python3爬虫验证码识别——超级鹰打码平台的使用实战:识别古诗文网登录页面中的验证码

一、验证码和爬虫之间的爱恨情仇&#xff1f; 反爬机制&#xff1a;验证码.识别验证码图片中的数据&#xff0c;用于模拟登陆操作。 二、识别验证码的操作&#xff1a; 人工肉眼识别。&#xff08;不推荐&#xff09;第三方自动识别&#xff08;推荐&#xff09; - 超级鹰打…

python爬虫模拟登录人人网

模拟登录&#xff1a;爬取基于某些用户的用户信息。 需求1&#xff1a;对人人网进行模拟登录。 点击登录按钮之后会发起一个post请求post请求中会携带登录之前录入的相关的登录信息&#xff08;用户名&#xff0c;密码&#xff0c;验证码…&#xff09;验证码&#xff1a;每次…

python爬虫——代理IP

代理&#xff1a;破解封IP这种反爬机制。 什么是代理&#xff1a; 代理服务器。 代理的作用&#xff1a; 突破自身IP访问的限制。隐藏自身真实IP 代理相关的网站&#xff1a; - 快代理 西祠代理www.goubanjia.comhttps://ip.jiangxianli.com/?page1 代理ip的类型&#…

ES 安装、search、index、doc

文章目录1. 安装2. search3. index4. doc CRUDop_type获取 doc 元字段只获取 doc 源数据删除 docupdate doc1. 安装 https://www.elastic.co/cn/ 下载 https://www.elastic.co/cn/downloads/past-releases/elasticsearch-8-5-3 https://www.elastic.co/cn/downloads/past-rele…

UWP开发入门(十一)——Attached Property的简单应用

UWP中的Attached Property即附加属性&#xff0c;在实际开发中是很常见的&#xff0c;比如Grid.Row: <Grid Background"{ThemeResource ApplicationPageBackgroundThemeBrush}"><Grid.RowDefinitions><RowDefinition></RowDefinition><Ro…

一、bootstrap4基础(布局系统、栅格系统、显示与隐藏、对齐与排列、内容排版、代码与图文、表格样式、颜色和边框、工具类)

1.1 Bootstrap简单介绍 1.2 Bootstrap结构 1.3 Bootstrap安装和测试 1.4 布局系统 1.5 栅格系统 4.6 栅格等级 1.7 显示与隐藏 1.7 对齐与排列 1.8 内容排版 1.9 代码与图文 1.9.1 设置图片居中显示 1.9.1 设置图片响应式显示 1.9.2 设置图片缩略图显示&#xff0c;以及显示的位…

二、bootstrap4基础(flex布局)

1.1 Flex弹性布局&#xff08;一&#xff09; <div class"d-flex flex-column border border-danger justify-content-end mb-5" style"height: 200px;"><div class"p-2 border border-success">one</div><div class"…

三、bootstrap4 组件(警告和提示框、徽章和面包屑、按钮按钮组、卡片、列表组、导航和选项卡、分页和进度条、巨幕和旋转图标、轮播图、折叠菜单、下拉菜单、导航条、滚动监听、轻量弹框、模态框、表单)

1.1 警告提示框 1.2 徽章和面包屑 1.3 按钮和按钮组 1.4 卡片 1.5 列表组 1.6 导航和选项卡 1.7 分页和进度条 1.8 巨幕和旋转图标 1.9 轮播图 1.10 折叠菜单 1.11 下拉菜单 <!DOCTYPE html> <html><head><meta charset"utf-8" /><title&…

十三、axios框架学习

一、axios的基本使用 1.1 安装axios 执行命令&#xff1a;npm install axios --save 1.2 发送get请求演示 1.3 发送并发请求 有时候, 我们可能需求同时发送两个请求 使用axios.all, 可以放入多个请求的数组.axios.all([]) 返回的结果是一个数组&#xff0c;使用 axios.sp…

LeetCode解题汇总目录

此篇为学习完《数据结构与算法之美》后&#xff0c;在LeetCode刷题的汇总目录&#xff0c;方便大家查找&#xff08;CtrlFind&#xff09;&#xff0c;一起刷题&#xff0c;一起PK交流&#xff01;如果本文对你有帮助&#xff0c;可以给我点赞加油&#xff01; Updated on 2022…

一、node.js搭建最简单的服务器

node.js搭建最简单的服务器 代码演示&#xff1a; // 1. 加载http核心模块 var http require(http)// 2. 使用http.createServer()方法创建一个Web服务器 // 返回一个Server实例 var server http.createServer()// 3. 服务器干嘛&#xff1f; // 提供服务&#xff1a; 对数…

DDD 领域驱动设计-如何 DDD?

注&#xff1a;科比今天要退役了&#xff0c;我是 60 亿分之一&#xff0c;满腹怀念&#xff5e;??? 前几天看了园友的一篇文章《我眼中的领域驱动设计》&#xff0c;文中有段话直击痛点&#xff1a;有人误认为项目架构中加入 Repository&#xff0c;Domain&#xff0c;Valu…

二、搭建Apache服务器 模板引擎

1. 案例&#xff1a;搭建简单的Apache服务器 var http require(http) var fs require(fs)var server http.createServer()var wwwDir D:\\CWork\\node.js黑马程序员\\study_nodejs\\day02\\code\\wwwserver.on(request, function(req, res) {var url req.urlfs.readFile(…

三、案例:留言板 url.parse()

1. url.parse()的使用 2. 留言板案例 index.html: <!DOCTYPE html> <!-- saved from url(0027)http://192.168.150.76:3000/ --> <html lang"en"><head><meta http-equiv"Content-Type" content"text/html; charsetUTF-8…

一、AJAX学习笔记——原生AJAX (ajax简介、XML简介、ajax优缺点、ajax的使用)

第 1 章&#xff1a;原生 AJAX 1.1 AJAX 简介 AJAX 全称为 Asynchronous JavaScript And XML&#xff0c;就是异步的 JS 和 XML。 通过 AJAX 可以在浏览器中向服务器发送异步请求&#xff0c; 最大的优势&#xff1a;无刷新获取数据。 AJAX 不是新的编程语言&#xff0c;而是…

App安全之网络传输安全

移动端App安全如果按CS结构来划分的话&#xff0c;主要涉及客户端本身数据安全&#xff0c;Client到Server网络传输的安全&#xff0c;客户端本身安全又包括代码安全和数据存储安全。所以当我们谈论App安全问题的时候一般来说在以下三类范畴当中。 App代码安全&#xff0c;包括…

二、nodemon-Node.js 监控工具

nodemon-Node.js 监控工具 https://www.npmjs.com/package/nodemon 这个工具在我们改变了服务端代码时&#xff0c;会自动重启服务器&#xff0c;不需要我们再手动去重启服务器了&#xff0c;方面我们后面调试代码&#xff01; 1. 安装 node &#xff1a;http://nodejs.cn/d…

利用动态规划(DP)解决 Coin Change 问题

问题来源 这是Hackerrank上的一个比较有意思的问题&#xff0c;详见下面的链接&#xff1a; https://www.hackerrank.com/challenges/ctci-coin-change 问题简述 给定m个不同面额的硬币&#xff0c;C{c0, c1, c2…cm-1}&#xff0c;找到共有几种不同的组合可以使得数额为n的…

jquery datatable设置垂直滚动后,表头(th)错位问题

jquery datatable设置垂直滚动后&#xff0c;表头(th)错位问题 问题描述&#xff1a; 我在datatable里设置&#xff1a;”scrollY”: ‘300px’,垂直滚动属性后&#xff0c;表头的宽度就会错位&#xff0c;代码如下&#xff1a; <!-- HTML代码 --> <table id"dem…

三、解决ie缓存问题

解决 IE 缓存问题 问题&#xff1a;在一些浏览器中(IE),由于缓存机制的存在&#xff0c;ajax 只会发送的第一次请求&#xff0c;剩余多次请求不会在发送给浏览器而是直接加载缓存中的数据。 在谷歌浏览器中&#xff0c;修改了服务器代码&#xff0c;重新发送请求时&#xff0…