[自然语言处理]概述

【自然语言处理】自然语言处理NLP概述及应用 自然语言处理(Natural Language Processing,简称NLP)是一门集计算机科学、人工智能以及语言学于一体的交叉学科,致力于让计算机能够理解、解析、生成和处理人类的自然语言。它是人工智能领域的一个关键分支,旨在缩小人与机器之间的交流障碍,使得机器能够更有效地识别并响应人类的自然语言指令或内容。 阅读详情

1 概念

  • 自然语言处理(natural processing laguage)是计算机科学与语言学中关注于计算机与人类语言间转换的领域。
  • 简史:
    • 1950年,计算机科学之父图灵在论文中提出“机器可以思考吗”;这一划时代的问题,从此促成了人类语言学与计算机科学的交融
    • 1957-1970年,自然语言处理开始形成“两大阵营”,基于规则和基于统计
    • 1994-1999年,基于统计的方法逐渐取得胜利,概率计算开始引入到NLP领域的每个任务中
    • 2000-2008年,机器学习开始兴起,迅速占领了NLP的主流市场
    • 2015-2023年,人工智能时代到来,深度学习技术将深刻改变NLP的未来
    • 2023年至今,大模型AIGC时代
  • 应用场景:语音助手、机器翻译、搜索引擎、智能问答

2 文本处理的基本方法

  • 将文本语料处理成符合模型输入的要求
  • 文本处理的基本方法:分词、词性标注、命名实体识别
  • 文本张量表示方法
    • one-hot编码:get_dummies
  • jieba的特性
    • 支持多种分词模式(粗粒度&细粒度)
      • 精确模式
      • 全模型
      • 搜索引擎模式
    • 支持中文繁体分词
    • 支持用户自定义词典
import jieba


# 精确模式:按照人类日常用语表达习惯来分词
def dm01_test():
    content = '分词就是将连续的字序列按照一定的规范重新组合成词序列的过程。'
    result1 = jieba.cut(content, cut_all=False)
    # print(result1)
    # for value in result1:
    #     print(value)
    # print(list(result1))
    # 返回生成器,默认cut_all=False
    result2 = jieba.lcut(content, cut_all=False)
    print(result2)


# 全模式:只要能成词的都进行切分,容易造成歧义
def dm02_test():
    content = '分词就是将连续的字序列按照一定的规范重新组合成词序列的过程。'
    result1 = jieba.cut(content, cut_all=True)
    # print(result1)
    # for value in result1:
    #     print(value)
    # print(list(result1))

    result2 = jieba.lcut(content, cut_all=True)
    print(result2)


# 搜索引擎模式:在精确模式基础上,对长词进行再次切分
def dm03_test():
    content = '分词就是将连续的字序列按照一定的规范重新组合成词序列的过程。'
    result = jieba.lcut_for_search(content)
    print(result)


# 支持繁体
def dm04_test():
    content = '煩惱即是菩提,我暫且不提'
    result = jieba.lcut(content)
    print(result)

# 支持用户自定义词典:如果用户使用自定义词典,jieba会优先按照词典进行分词
def dm05_test():
    # 不采用词典进行分词
    sentence='jieba分词就是将连续的字序列按照一定的规范重新组合成词序列的过程。'
    result1=jieba.lcut(sentence)
    print(result1)
    # 采用自定义词典
    jieba.load_userdict('./user_dict.txt')
    result2 = jieba.lcut(sentence)
    print(result2)


if __name__ == '__main__':
    dm01_test()
    dm02_test()
    dm03_test()
    dm04_test()
    dm05_test()
['分词', '就是', '将', '连续', '的', '字', '序列', '按照', '一定', '的', '规范', '重新组合', '成词', '序列', '的', '过程', '。']
['分词', '就是', '将', '连续', '的', '字', '序列', '按照', '一定', '的', '规范', '重新', '重新组合', '组合', '组合成', '合成', '合成词', '词序', '序列', '的', '过程', '。']
['分词', '就是', '将', '连续'
自然语言处理(NLP)概述 自然语言处理是一个充满挑战和机遇的领域,通过计算机与人类语言的互动,实现更自然和高效的人机交互。NLP技术广泛应用于语音助手、聊天机器人、内容推荐等领域。随着技术的不断发展,NLP将在更多领域发挥重要作用。 阅读详情

相关推荐

自然语言处理NLP概述

大家好,自然语言处理(NLP)是计算机科学领域与人工智能领域中的一个重要方向,其研究能实现人与计算机之间用自然语言进行有效通信的各种理论和方法。本文将从自然语言处理的本质、原理和应用三个方面,对其进行概述。NLP是一种机器学习技术,使计算机能够解读、处理和理解人类语言,其本质就是人类和机器之间沟通的桥梁。人类使用自然语言交流,如中文、英文等,狗通过叫声和其他身体语言交流,机器使用数字信息进行交流。人类与机器之间存在交流障碍,因为人类不直接理解数字信息,而机器不直接理解自然语言。

csdn1561168266的博客 4132

入坑NLP - 自然语言处理领域概述

自然语言处理研究的内容包括但不限于如下分支:文本分类、信息抽取、自动摘要、智能问答、话题推荐、机器翻译、主题词识别、知识库构建、深度文本表示、命名实体识别、文本生成、文本分析(词法、句法、语法)、语音识别与合成等。并对一些分支领域进行了详细介绍。

zzwwsun 2万+

贪婪算法在自然语言处理中的应用及NLP概述

贪心算法在NLP中是一种常用的优化策略,可以用于分词、基于规则的语法分析、文本摘要等任务。NLP涵盖了词法分析、句法分析、语义分析、机器翻译、情感分析等多个领域和任务,每个任务都有其特定的算法和技术。随着深度学习的发展,基于神经网络的模型在NLP中取得了显著的成果,并成为当前研究的热点。分词是将连续的文本序列切分成词语的过程,而词性标注是确定每个词语的词性(名词、动词、形容词等)。句法分析:句法分析是研究句子的句法结构,包括句子成分(主语、谓语、宾语等)之间的关系。文本摘要:贪心算法可以用于生成文本摘要。

ZksProlog的博客 351

吉林大学2016级唐班c语言期末考试B卷

` #include<stdio.h> #include<stdlib.h> //双指针法,每次从a,b中选一个最大的数,从后向前一次放在数组a中 int merge(int *a,int m,int *b,int n){ int i=m-1,j=n-1,k=m+n-1; while(i>=0&&j>=0){ if(a[i]>b[j])a[...

weixin_42339173的博客 1195

使用QGIS配准无人机航片

随着无人机在各个行业的普及,无人机航片成为很多应用系统空间数据的重要来源。无人机航片具有成像快、分辨率高、针对性强的优点,广泛用于保险定损、灾情应急监测、设施巡检、农作物面积调查等方面。 然而,由于种种原因,通过无人机拍摄的照片拼接得到的正射航片与其他地理空间数据叠加时经常出现较明显的偏差,需要进行配准以校正其空间位置,因此,本文将使用QGIS的配准工具演示无人机正射航片配准的过程。 01数据情况 本文选用的示范数据为2020年7月中左右无人机拍摄的河北省某地系列照片,经过拼接得到CG...

QGISClass的博客 5249

OpenMythos深度解析

本文深入解析了kyegomez/OpenMythos项目如何从第一性原理重建Claude Mythos的核心架构。该项目并非直接复制Claude,而是基于公开论文和实验结果推测其可能的设计理念,构建了包含多模态注意力、深度推理引擎、知识检索模块等六大核心组件的模块化架构。重点剖析了分组查询注意力(GQA)的实现细节,展示了KV头扩展等关键技术。该项目已成为大模型开源社区最受关注的研究之一,为理解Claude的架构思想提供了有价值的参考。

Crown_22的博客 519

自适应控制 (Adaptive Control) 算法详解及案例分析

自适应控制是一种能够在线调整控制器参数以适应系统动态变化的控制方法。其核心思想是通过实时估计系统参数或调整控制器参数,使系统在不确定性或动态变化的环境中仍能保持稳定性和性能。

闲人编程的博客 4086

基于YOLOv8的MVTec AD缺陷检测系统设计与实现

速度快,精度高;支持 anchor-free 架构;支持实例分割和图像分类;模块化代码,易于部署与改进;完美兼容 ONNX、TensorRT 等推理框架;官方支持多平台训练和推理(CPU/GPU)。YOLOv8 是工业视觉检测落地非常理想的选择。MVTec AD(Anomaly Detection)数据集包括15类工业对象,每个对象包括多个子类缺陷(例如 “scratch”, “crack”, “hole”)及正常图像。类别缺陷子类bottlecablecapsule。

YOLO 932

第29章:PCL PrincipalCurvatures 曲率估计

PrincipalCurvatures(主曲率估计)是一种用于计算点云表面曲率的算法。曲率描述了曲面局部的弯曲程度,是表面几何特征的重要指标。在点云处理中,估计表面的曲率对于形状分析、物体识别、表面重建等任务非常重要。主曲率是曲面上某一点的最大和最小曲率方向。通过计算点云的主曲率,我们可以获得点云中每个点的局部形状特征。通常情况下,主曲率包括两个主要参数:最大主曲率(最大曲率方向上的曲率)和最小主曲率(最小曲率方向上的曲率)。优点缺点提供了对点云表面局部形状的深入分析。

yumeiguo的博客 214

【AI编程】Vibe Coding 开发环境搭建与项目实战操作详解

Vibe Coding 开发环境搭建与项目实战操作详解

congge 7344

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

上一篇: [深度学习]循环神经网络RNN
下一篇: [自然语言处理]RNN
Letmooning
博客等级 码龄2年 503粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值