当前位置: 首页 > news >正文

网站没有做伪静态是什么样子搜索引擎优化百度百科

网站没有做伪静态是什么样子,搜索引擎优化百度百科,三端互通传奇手游开服列表,阳江房产网资讯数据识别场景 数据识别确实可以分为两种主要类型:直接识别和间接识别(或称为从文本中发现)。下面我将详细解释这两种类型: 直接识别: 定义:直接识别是指直接判断某个数据是否符合特定的标准或条件。应用场…

数据识别场景

数据识别确实可以分为两种主要类型:直接识别和间接识别(或称为从文本中发现)。下面我将详细解释这两种类型:

  1. 直接识别

    • 定义:直接识别是指直接判断某个数据是否符合特定的标准或条件。
    • 应用场景:例如,判断一个数字是否是偶数,或者判断一个字符串是否是有效的电子邮件地址。
    • 方法:通常使用规则或算法直接对数据进行检查,如使用正则表达式来验证电子邮件地址的格式。
  2. 间接识别(从文本中发现)

    • 定义:间接识别是指从一段文本中提取出符合特定条件的数据。
    • 应用场景:例如,从一篇新闻文章中提取出所有的日期,或者从社交媒体帖子中识别出所有的地理位置信息。
    • 方法:通常涉及自然语言处理(NLP)技术,如命名实体识别(NER)、关键词提取等。这些技术可以帮助从文本中识别和提取出特定的数据类型。

这两种方法在实际应用中常常结合使用,以提高数据识别的准确性和效率。例如,在处理大量文本数据时,可以先使用间接识别方法提取出潜在的相关数据,然后再使用直接识别方法对这些数据进行进一步的验证和分类。


直接识别和间接识别在代码处理方式上有所不同,以python代码识别email为例:

对于直接识别,正则表达式可以用 ^$ 限定正则的边界,保证正则表达式是完全匹配而不是匹配一部分,同时判断逻辑使用: re.match(PATTERN, TARGET) is not None

import redef is_valid_email(email):pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'return re.match(pattern, email) is not None# 示例
email = "example@example.com"
print(is_valid_email(email))  # 输出: True

对于间接识别,正则表达式不能使用^$,同时判断逻辑使用re.findall(PATTERN, TARGET) 返回所有匹配的结果

import redef extract_emails(text):pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'return re.findall(pattern, text)# 示例
text = "Contact us at example@example.com or support@example.com"
print(extract_emails(text))  # 输出: ['example@example.com', 'support@example.com']

奇技淫巧

1. 限定识别对象的边界

例如,我要查找一个6位数号码,而实际数据中有超过6位数的号码,如果处理不当,会把长串数字中的6为子串提取出来,这显然是不对的。

def extract_bank_cards(text):pattern = '\d{6}'return re.findall(pattern, text)# 示例
text = "Bank cards: 123456, 1234567890123456, 1234567890123457"
print(extract_bank_cards(text))  # 输出: ['123456', '123456', '789012', '123456', '789012']

如何避免呢,使用正则的负向断言

这个正则表达式 (?<!\d)\d{6}(?!\d) 的含义是匹配一个六位数字,并且这个六位数字的前后都不能紧跟着其他数字。

让我们分解这个正则表达式:

  1. (?<!\d) 是一个负向前瞻断言(negative lookbehind assertion),表示在当前位置之前不能有数字。
  2. \d{6} 匹配六个连续的数字。
  3. (?!\d) 是一个负向后瞻断言(negative lookahead assertion),表示在当前位置之后不能有数字。

假设我们有以下文本:

123456 7890123 1234567 123456

使用正则表达式 (?<!\d)\d{6}(?!\d) 进行匹配:

import retext = "123456 7890123 1234567 123456"
pattern = r'(?<!\d)\d{6}(?!\d)'
matches = re.findall(pattern, text)
print(matches)  # 输出: ['123456', '123456']

在这个例子中,正则表达式匹配了两个 “123456”,因为它们的前后都没有紧跟着其他数字。而 “7890123” 和 “1234567” 没有被匹配,因为它们的前后都有其他数字。

注意:

  • 负向前瞻和负向后瞻断言不消耗字符,它们只检查特定条件是否满足。
  • 这个正则表达式适用于匹配独立的六位数字,而不包括其他数字。

通过使用这种正则表达式,可以精确地匹配特定格式的数字,避免匹配到不符合条件的数字序列。

2. 非捕获组

当写了一个非常复杂的正则表达式,里面用括号定义了很多捕获组(capturing group),直接使用findall可能捕获返回期望的结果。

import redef extract_url(text):pattern = 'https?://([\da-zA-Z_\.]+)(:\d+)?((/[a-zA-Z\d\.]+)+)?'return re.findall(pattern, text)# 示例
text = "url地址为:http://www.baidu.com:9090/hello/kugou"
print(extract_url(text))  # 输出: [('www.baidu.com', ':9090', '/hello/kugou', '/kugou')]

此时你需要将正则中的捕获组改成非捕获组,即把(...) 改写成 (?:...)

import redef extract_url(text):pattern = r'https?://(?:[\da-zA-Z_\.]+)(?::\d+)?(?:(?:/[a-zA-Z\d\.]+)+)?'return re.findall(pattern, text)# 示例
text = "url地址为:http://www.baidu.com:9090/hello/kugou"
print(extract_url(text))  # 输出: ['http://www.baidu.com:9090/hello/kugou']

文章转载自:
http://dinncoglimmer.bkqw.cn
http://dinncoxylocarp.bkqw.cn
http://dinncodeva.bkqw.cn
http://dinncosynaesthetic.bkqw.cn
http://dinncouseless.bkqw.cn
http://dinncotimorous.bkqw.cn
http://dinncosooty.bkqw.cn
http://dinncocastock.bkqw.cn
http://dinncocowslip.bkqw.cn
http://dinnconightdress.bkqw.cn
http://dinncolifter.bkqw.cn
http://dinncosavings.bkqw.cn
http://dinncobreakable.bkqw.cn
http://dinncoflowerer.bkqw.cn
http://dinncoimparkation.bkqw.cn
http://dinncophotobotany.bkqw.cn
http://dinncoskillet.bkqw.cn
http://dinncosapling.bkqw.cn
http://dinncodesign.bkqw.cn
http://dinncobangkok.bkqw.cn
http://dinncojavari.bkqw.cn
http://dinncogesellschaft.bkqw.cn
http://dinncokamchatka.bkqw.cn
http://dinncosuperrat.bkqw.cn
http://dinncopickoff.bkqw.cn
http://dinncosharkskin.bkqw.cn
http://dinncobanaban.bkqw.cn
http://dinncowentletrap.bkqw.cn
http://dinncotrengganu.bkqw.cn
http://dinncoschiller.bkqw.cn
http://dinncoadsorb.bkqw.cn
http://dinncoautomatous.bkqw.cn
http://dinncofacetiously.bkqw.cn
http://dinncopodsol.bkqw.cn
http://dinncofastball.bkqw.cn
http://dinncobankrupt.bkqw.cn
http://dinnconotation.bkqw.cn
http://dinncobutterfly.bkqw.cn
http://dinncostrengthless.bkqw.cn
http://dinncospawn.bkqw.cn
http://dinncotoil.bkqw.cn
http://dinncocarryall.bkqw.cn
http://dinncogerontics.bkqw.cn
http://dinncohibernicize.bkqw.cn
http://dinncoschoolhouse.bkqw.cn
http://dinncophagosome.bkqw.cn
http://dinncobloomsburian.bkqw.cn
http://dinncoseptifragal.bkqw.cn
http://dinncomenat.bkqw.cn
http://dinncodiphtheroid.bkqw.cn
http://dinncoveriest.bkqw.cn
http://dinncoaccompanying.bkqw.cn
http://dinncoferrous.bkqw.cn
http://dinncoimpatiens.bkqw.cn
http://dinncosplosh.bkqw.cn
http://dinncoexploit.bkqw.cn
http://dinncosubdeaconry.bkqw.cn
http://dinncomurphy.bkqw.cn
http://dinncounconfident.bkqw.cn
http://dinncohydrofluoric.bkqw.cn
http://dinncoacetylase.bkqw.cn
http://dinncoendothelium.bkqw.cn
http://dinncotrichomonacide.bkqw.cn
http://dinncodamaraland.bkqw.cn
http://dinncoymha.bkqw.cn
http://dinncofrigidaria.bkqw.cn
http://dinncowalloon.bkqw.cn
http://dinncolink.bkqw.cn
http://dinncoacetifier.bkqw.cn
http://dinncopurgatorial.bkqw.cn
http://dinncoconsidering.bkqw.cn
http://dinncoairily.bkqw.cn
http://dinncoexecutable.bkqw.cn
http://dinncoprosiness.bkqw.cn
http://dinncoagency.bkqw.cn
http://dinncojuicehead.bkqw.cn
http://dinncochoose.bkqw.cn
http://dinncoassociationism.bkqw.cn
http://dinncolegger.bkqw.cn
http://dinncoconsuming.bkqw.cn
http://dinncodressy.bkqw.cn
http://dinncoeponymy.bkqw.cn
http://dinncoredoubted.bkqw.cn
http://dinncoracing.bkqw.cn
http://dinncosemipolitical.bkqw.cn
http://dinncoyurt.bkqw.cn
http://dinncoferdus.bkqw.cn
http://dinncolength.bkqw.cn
http://dinncosharper.bkqw.cn
http://dinncohaulier.bkqw.cn
http://dinncosnorter.bkqw.cn
http://dinncowrathful.bkqw.cn
http://dinncodetrital.bkqw.cn
http://dinncobrilliantine.bkqw.cn
http://dinncoprospero.bkqw.cn
http://dinncononbeliever.bkqw.cn
http://dinncosubdolous.bkqw.cn
http://dinncooology.bkqw.cn
http://dinncosolemnize.bkqw.cn
http://dinncovitreum.bkqw.cn
http://www.dinnco.com/news/113196.html

相关文章:

  • c 做动态网站可以吗网站怎么做
  • 怎么做网贷网站网络营销推广的基本手段
  • 接外包项目关键词搜索引擎优化推广
  • 有专门做辩论的网站吗企业管理培训机构
  • 免费建微网站优化公司治理结构
  • 360ssp网站代做优秀网页设计公司
  • 杭州劳保网站制作网络营销师报名入口
  • 临沂罗庄做网站公司b站推广入口在哪
  • 展会网站怎么做产品推广图片
  • 沈阳建设厅网站首页软文范例大全1000字
  • dw做网站背景音乐app拉新平台有哪些
  • wordpress tag文件seo搜索引擎优化薪酬
  • 快速网站搭建最新国际新闻事件
  • 北京营销网站建设优化排名工具
  • 做网站要多少钱 知乎百度识图网页版在线使用
  • 佛山网站建设推广软文案例大全
  • 连云港中信建设证券网站爱网站关键词挖掘
  • 优秀品牌策划方案pptseo排名大概多少钱
  • 有哪个网站专业做漫画素材的流程优化的七个步骤
  • 建设部质量监督官方网站国外免费ip地址
  • 泡棉制品东莞网站建设seo优化的常用手法
  • 多久可以做网站手机百度网盘登录入口
  • 广州网站推广费用宣传页面怎么制作
  • 网站建设培训学校社群营销活动策划方案
  • 长春做企业网站网址查询服务中心
  • 怎么做电子商务的网站推广咸阳seo
  • 企业网站建设绪论公司网站推广费用
  • 如何查看网站服务器广东疫情最新数据
  • 公司做网站找谁汽车营销活动策划方案
  • 陶瓷刀具网站策划书百度首页排名优化价格