package util // type Job struct { SourceMid string //数据源的MongoId Category string //类别 Content string //正文 ContentFile string //附件文本堆一起(后期可以考虑,分开处理) Title string //标题 SpiderCode string //爬虫代码 Domain string //网站域名 Href string //原文链接 City string //城市 Province string //省份 Data *map[string]interface{} //数据库源数据 Block []*Block //分块 Result map[string][]*ExtField //结果 BuyerAddr string //采购单位地址 BlockPackage map[string]*BlockPackage //块中的分包 Winnerorder []map[string]interface{} //中标候选人排序 PackageInfo map[string]map[string]interface{} //分包信息 BrandData [][]map[string]string // HasTable int //有table HasKey int //是否匹配到table中的标题 HasBrand int //有品牌 HasGoods int //有商品 } type ExtField struct { Field string //属性 Code string //匹配标签(字符串、正则)、正则或lua代码 RuleText string //内容 Type string //kv(细类:colon1,colon2,space,table)、正则(regexp) MatchType string //匹配类型:1:标签库类型(tag_string,tag_regexp),2:全文正则regcontent ExtFrom string //抽取来源(title,detail) Value interface{} //抽取结果 Score int //得分 } //块 type Block struct { Tags []Tags //对块做的标签,可以作为数据抽取的依据 Title string //块标题 Index int //块索引 Text string //块内容 Start int //开始索引 End int //结束索引 ColonKV *JobKv //冒号kv (分出的对应的KV值) TableKV *JobKv //table kv (分出的对应的KV值) SpaceKV *JobKv //空格 kv (分出的对应的KV值) BPackage *BlockPackage //分包信息 Tag map[string]bool //块标签 Block []*Block //子块 } //段落 type Segment struct { Index int //段落索引 Text string //段落内容 } //包 type BlockPackage struct { Index string //序号 (转换后编号,只有数字或字母) Origin string //包的原始值 Type string //类型 (匹配后面的标段、包之类的词) Text string //包文 (包对应的正文) ColonKV *JobKv //冒号kv (分出的对应的KV值) TableKV *JobKv //table kv (分出的对应的KV值) SpaceKV *JobKv //空格 kv (分出的对应的KV值) BidStatus string //成交状态 WinnerOrder []map[string]interface{} //中标人排序 Accuracy bool //包里面抽取字段的准确性,如果能打上块标签的话,就不用中标候选人中的值覆盖包里面的值 } //联系人 type ContactFormat struct { Direction int IndexMap map[int]string MatchMap map[string]map[string]bool WeightMap map[string]map[string]interface{} } //kv type Kv struct { Key string Value string Line string PrevLine string NextLine string Title string } //最终放到job上的kv type JobKv struct { Kvs []*Kv //有序的冒号kv Kvs_2 []*Kv //有序的冒号kv Kv map[string]string //table kv (分出的对应的KV值) KvIndex map[string]int //kv_index(流程) KvTag map[string]*Tag //带权重的kv } func NewJobKv() *JobKv { return &JobKv{ Kvs: []*Kv{}, Kvs_2: []*Kv{}, Kv: map[string]string{}, KvTag: map[string]*Tag{}, } }