火车:北京-西安

流程:
【1】单程  北京西  西安 2014-01-25  
     点击查询


【2】北京西  西安
     打钩


【3】选择乘车人
【4】T43   Z19  T55  T7  T231
     输入优先车次
【5】优先席别   硬卧
【6】高级设置   席别优先


选择自动提交




【4】   K1364
T232   17:44      06:05
T42    18:18  09:08
T44    19:00  08:29
Z20    19:55  07:10







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
import random # 地名代表词列表 places = ['北京', '上海', '广州', '深圳', '成都', '杭州', '武汉', '南京', '重庆', '西安'] # 时间代表词列表 times = ['今天', '明天', '后天', '周一', '周二', '周三', '周四', '周五', '周六', '周日'] # 生成50条自然语句 sentences = [] for i in range(50): r = random.randint(0, 5) if r == 0: sentences.append(f"请给我买一张从{random.choice(places)}到{random.choice(places)}的火车票。") elif r == 1: sentences.append(f"我想去{random.choice(places)},请帮我定一张火车票。") elif r == 2: sentences.append(f"我要乘坐明天的G1234次列车去{random.choice(places)}。") elif r == 3: sentences.append(f"请问明天从{random.choice(places)}到{random.choice(places)}的火车票还有吗?") else: sentences.append(f"请给我买一张{random.choice(times)}从{random.choice(places)},{random.choice(times)}到{random.choice(places)}的火车票。") # 定义标记函数 def tag_word(word): if word.startswith('北京') or word.startswith('上海') or word.startswith('广州') or word.startswith('深圳') or word.startswith('成都') or word.startswith('杭州') or word.startswith('武汉') or word.startswith('南京') or word.startswith('重庆') or word.startswith('西安'): if len(word) == 2: return 'B-Placeofdeparture', 'O' else: return 'B-Placeofdeparture', 'I-Placeofdeparture' elif word in ['今天', '明天', '后天', '周一', '周二', '周三', '周四', '周五', '周六', '周日']: if len(word) == 2: return 'B-Departuretime', 'O' else: return 'B-Departuretime', 'I-Departuretime' elif word.startswith('G') and word[1:].isdigit(): return 'O', 'O' else: if len(word) == 2: return 'B-Destination', 'O' else: return 'B-Destination', 'I-Destination' # 对每一个字进行标记 with open('ziran1234.txt', 'w') as f: for sentence in sentences: for word in sentence: tag1, tag2 = tag_word(word) f.write(f"{word}\t{tag1}\t{tag2}\n") f.write('\n')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ygmdream

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值