共享佳能2206打印机

  • 共享佳能2206打印机已关闭评论
  • A+
所属分类:远程维修
摘要

6毛黑白(复印扫描服务)”;//Stringstr=”17条信息共享佳能2206打印机700字6毛黑白(复印扫描服务)”;//Stringstr=”佳能2206打印机200字5毛黑白{复印扫描服务}”;//Stringstr=”佳能220

6毛黑白 (复印扫描服务)";
// String str="17 条信息共享佳能2206打印机700字6毛黑白(复印扫描服务)";
// String str="佳能2206打印机 200字5毛黑白 {复印扫描服务}";
// String str="佳能2206打印机500字6毛黑白 (复印扫描服务)";
// String str="联想雷神3 拆机 550元";
// String str="【便宜】联想雷神3 拆机 500元";
String str="联想雷神3拆机 850元(只卖机身)";
//System.out.println(str);
String[] sb=StringUtils.split(str);//解析句子
//for(String s : sb){
// System.out.println(s);
//}

//System.out.println("开始解析");
// 起始的由的位置和终止的位置
//int start=0;
//int end=0;
//int count=1;
//String word="";
//动态规划
List> wordList=DPparse(sb); //得到每一个位置所有可能性
System.out.println("解析完毕");

/*for(int i=0;i ws=wordList.get(i);
System.out.print("第"+i+"个");
for(Word w : ws){
System.out.println(w.name);
}
System.out.println("-----");
}*/

Product product=getProduct(wordList, sb);
System.out.println("name:"+product.name);
System.out.println("price:"+product.price);
System.out.println("desc:"+product.desc);
System.out.println("operate:"+product.operate);
}

//动态规划
public static List> DPparse(String[] sb) {
int length=sb.length;
List> wordList=new ArrayList>();
for(int i=0;i());
}
for(int i=0;i words=patternMatch.match(sb[i]); //对每一个词进行解析
for(Word word : words){
wordList.get(i).add(word);//把这些解析有的结果加入到动态规划中
}
if(i!=0){
List preWords=wordList.get(i-1);//上一个位置的词
for(Word word : preWords){
List ws=patternMatch.match(sb[i], word);
for(Word w : ws){
wordList.get(i).add(w);
}
}
}
//System.out.println("第:"+i+"个:"+words.size());
}
return wordList;
}

//从动态规划中解析出产品
public static Product getProduct(List> wordList,String[] sb){
Product product=new Product();

//解析name
String name="";
for(int i=0;i ws=wordList.get(i);
for(Word w : ws){
if(w.type==Word.TYPE_NAME){
name+=sb[i]+" ";
}
}
}
product.name=name.trim();
//System.out.println("name:"+product.name);

//解析价格
for(int i=0;i ws=wordList.get(i);
for(Word

  • 微信在线客服
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 扫一扫码上服务
  • weinxin