锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品GV天堂无码男同,亚洲乱码一区二区三区在线观看 ,亚洲福利在线播放http://www.tkk7.com/nianzai/archive/2013/05/14/399262.htmlnianzainianzaiTue, 14 May 2013 08:31:00 GMThttp://www.tkk7.com/nianzai/archive/2013/05/14/399262.htmlhttp://www.tkk7.com/nianzai/comments/399262.htmlhttp://www.tkk7.com/nianzai/archive/2013/05/14/399262.html#Feedback1http://www.tkk7.com/nianzai/comments/commentRss/399262.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/399262.htmlpublic class NIOServer...  闃呰鍏ㄦ枃

nianzai 2013-05-14 16:31 鍙戣〃璇勮
]]>
瀹炶返鏄渶濂界殑鐞嗚В鏂瑰紡http://www.tkk7.com/nianzai/archive/2013/04/27/398482.htmlnianzainianzaiSat, 27 Apr 2013 02:13:00 GMThttp://www.tkk7.com/nianzai/archive/2013/04/27/398482.htmlhttp://www.tkk7.com/nianzai/comments/398482.htmlhttp://www.tkk7.com/nianzai/archive/2013/04/27/398482.html#Feedback0http://www.tkk7.com/nianzai/comments/commentRss/398482.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/398482.html    鎴戝涓滆タ閫氬父鏄氳繃鍔ㄦ墜鐨勬柟寮忔潵瀛︿範錛屾瘮濡傛渶榪戝涔犲垎甯冨紡鏈嶅姟鍗忚paxos,鑷繁灝卞姩鎵嬪紑鍙戜簡涓涓鍗忚鐨勫疄鐜扮増鏈傚鏋滀笉鍔ㄦ墜瀹炵幇鍙槸闈犲涔犵悊璁烘槸寰堥毦鐞嗚В榪欎釜鐞嗚鐨勬湰韜傜悊瑙e畠鏈濂界殑鏂瑰紡灝辨槸瀹炶返瀹冦?/p>


    鏍規嵁鐞嗚鎴栬呭師鐞嗗氨鏉ュ仛瀹炵幇紜疄寰堥毦錛岃繖闇瑕佸緢寮虹殑浠g爜鍔熷簳銆佹瀬楂樼殑鐞嗚В鑳藉姏浠ュ強鎸佷箙鐨勮愬績銆?/p>


    鎵庡疄鐨勫姛搴曟槸涓鍒囩殑寮濮嬶紝娌℃湁鎵庡疄鐨勫姛搴曞氨鏃犳硶涓嬫墜銆傛病鏈夊緢濂界殑鎮熸у氨寰堥毦淇濊瘉浜嬫儏鐨勬紜с傛病鏈夎壇濂界殑鑰愬績灝卞緢闅句繚璇佷簨鎯呯殑緇撴灉銆備竴嬈℃у氨鑳藉皢浜嬫儏鍋氭垚鍋氬ソ鐨勶紝榪欑浜哄疄鍦ㄥお灝戜簡銆傚仛鎴愪竴浠朵簨鎯呭氨鏄湪鏃犳暟鐨勫け璐ャ侀敊璇腑鏉ユ帴榪戞垚鍔燂紝閫氳繃澶辮觸鏉ョ籂姝c佷粠鑰屼竴姝ヤ竴姝ョ殑鎺ヨ繎鎴愬姛銆傝繖灝辨敞瀹氫簡闇瑕佹寔涔呯殑鑰愬績鎵嶈兘淇濊瘉鎴愬姛銆?/p>

nianzai 2013-04-27 10:13 鍙戣〃璇勮
]]>
鍒嗗竷寮忔湇鍔″崗璁畃axos浠茶瀹炵幇浠g爜http://www.tkk7.com/nianzai/archive/2013/04/23/398272.htmlnianzainianzaiTue, 23 Apr 2013 05:19:00 GMThttp://www.tkk7.com/nianzai/archive/2013/04/23/398272.htmlhttp://www.tkk7.com/nianzai/comments/398272.htmlhttp://www.tkk7.com/nianzai/archive/2013/04/23/398272.html#Feedback0http://www.tkk7.com/nianzai/comments/commentRss/398272.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/398272.html2銆乴eader鍚戞墍鏈夌殑QuorumPeer鍙戝嚭鎶曠エ璇鋒眰
3銆丵uorumPeer瀵硅璇鋒眰榪涜鎶曠エ錛屽鏋滄秷鎭殑txid澶т簬QuorumPeer鐨則xid鍒欓氳繃璇ユ姇紲紝鍚﹀垯鍙嶅璇ユ姇紲?br />4銆乴eader鏍規嵁鎵鏈夌殑QuorumPeer鎶曠エ緇撴灉榪涜璁$畻錛屽鏋滄湁涓鍗婁互涓婄殑QuorumPeer閫氳繃鍒欐帴鍙楁彁鍑鴻呯殑璇鋒眰錛屽惁鍒欐嫆緇濇彁鍑鴻呯殑璇鋒眰
        switch (message.getType())
        
{
            
case QuorumCode.ask://璇㈤棶綾誨瀷
                
//璇㈤棶璇ヤ簨鍔℃槸鍚﹀彲鎿嶄綔
                Ask task=new Ask(message,sc);
                My.executor.execute(task);
                m.setCode(JuiceCode.OK);
                
break;
            
case QuorumCode.vote://鎶曠エ綾誨瀷
                if(My.txid>=message.getTxid())
                    
//鎷掔粷
                    m.setCode(JuiceCode.ERROR);
                
else
                
{
                    
//閫氳繃
                    m.setCode(JuiceCode.OK);
                    My.updateMyTxid(message.getTxid());
                }

                
break;
            
case QuorumCode.ping://ping
                m.setCode(JuiceCode.OK);
                m.setMyid(message.getMyid());
                
break;
        }



    
public static boolean sendAndVote(Message m) throws IOException
    
{
        m.setType(QuorumCode.vote);
        Map
<Integer,Response> mp=new TreeMap<Integer,Response>();
        
for(Map.Entry<Integer,NIOClient> entry:voteClientMap.entrySet())
        
{
            NIOClient client
=entry.getValue();
            Response response
=client.send(ByteUtil.getBytes(m));
            mp.put(entry.getKey(), response);
        }


        Map
<Integer,Message> vote=new TreeMap<Integer,Message>();
        
for(Map.Entry<Integer,Response> entry:mp.entrySet())
            vote.put(entry.getKey(), (Message)ByteUtil.getObject(entry.getValue().getData()));

        
int ok=0;
        
for(Map.Entry<Integer,Message> entry:vote.entrySet())
        
{
            Message f
=entry.getValue();
            
if(f.getCode()==JuiceCode.OK)
                ok
++;
        }

        
if(ok/(vote.size()*1.0)>1/2.0)
            
return true;
        
return false;
    }




nianzai 2013-04-23 13:19 鍙戣〃璇勮
]]>
鍒嗗竷寮忔湇鍔″崗璁畃axos涓璴eader閫変婦瀹炵幇浠g爜http://www.tkk7.com/nianzai/archive/2013/04/17/397958.htmlnianzainianzaiWed, 17 Apr 2013 03:15:00 GMThttp://www.tkk7.com/nianzai/archive/2013/04/17/397958.htmlhttp://www.tkk7.com/nianzai/comments/397958.htmlhttp://www.tkk7.com/nianzai/archive/2013/04/17/397958.html#Feedback0http://www.tkk7.com/nianzai/comments/commentRss/397958.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/397958.html1銆佹敹闆嗙涓杞姇紲ㄧ粨鏋?br />2銆佺粺璁℃姇紲ㄦ暟錛岃綆楀嚭鎶曠エ鏁版渶澶х殑id
3銆佸鏋滄姇紲ㄦ暟瓚呰繃1/2鍒欓夎id涓簂eader
4銆佸鏋滄渶澶ф姇紲ㄦ暟id娌℃湁瓚呰繃1/2,鍒欐帹鑽恡xid鏈澶х殑id涓簂eader
5銆佽綆楀嚭鏈澶х殑txid鍙婂叾鏈嶅姟鍣╥d
6銆佽綆楀嚭鏈澶х殑txid鏈夊嚑涓?br />7銆佸鏋滄渶澶xid瓚呰繃涓涓紝鍒欐瘮杈冩湇鍔″櫒id錛屾帹鑽愭湇鍔d鏈澶х殑涓簂eader
8銆佸彂璧風浜岃疆鎶曠エ

Java瀹炵幇浠g爜濡備笅錛?br />
        /**
         * 閫変婦leader
         * 
@param vote 鎶曠エ淇℃伅
         * 
@return
         
*/

        
public int forLeader(Map<Integer,Notification> vote)
        
{
            
//緇熻leader鎶曠エ鏁?/span>
            TreeMap<Integer,Integer> tmap=new TreeMap<Integer,Integer>();
            
for(Map.Entry<Integer,Notification> entry:vote.entrySet())
            
{
                Notification nf
=entry.getValue();
                
if(tmap.containsKey(nf.leader))
                    tmap.put(nf.leader, tmap.get(nf.leader)
+1);
                
else
                    tmap.put(nf.leader, 
1);
            }

            
//璁$畻鍑烘姇紲ㄦ暟鏈澶х殑id
            int a=0;
            
int l=0;
            
for(Map.Entry<Integer,Integer> entry:tmap.entrySet())
            
{
                
if(entry.getValue()>a)
                
{
                    a
=entry.getValue();
                    l
=entry.getKey();
                }

            }

            
//濡傛灉鎶曠エ鏁拌秴榪?/2鍒欓夎id涓簂eader
            if(a/(My.serverList.size()*1.0)>1/2.0)
            
{
                
//閫夊嚭leader
                if(l==My.myid)
                    My.myServerState
=ServerState.LEADING;
                
else
                    My.myServerState
=ServerState.FLLOWING;
                My.leader
=l;
                
                
return -1;
            }

            
//濡傛灉鏈澶ф姇紲ㄦ暟leader娌℃湁瓚呰繃1/2,鍒欐帹鑽恡xid鏈澶х殑id涓簂eader
            
//璁$畻鍑烘渶澶х殑txid鍙婂叾鏈嶅姟鍣╥d
            long txid=0;
            
int leader=0;
            
for(Map.Entry<Integer,Notification> entry:vote.entrySet())
            
{
                
if(entry.getValue().txid>txid)
                
{
                    leader
=entry.getKey();
                    txid
=entry.getValue().txid;
                }

            }

            
//璁$畻鍑烘渶澶х殑txid鏈夊嚑涓?/span>
            Map<Integer,Notification> vte=new TreeMap<Integer,Notification>();
            
for(Map.Entry<Integer,Notification> entry:vote.entrySet())
            
{
                
if(entry.getValue().txid==txid)
                
{
                    vte.put(entry.getValue().id, entry.getValue());
                }

            }

            
//濡傛灉瓚呰繃涓涓紝鍒欐瘮杈冩湇鍔″櫒id錛屾帹鑽愭湇鍔d鏈澶х殑涓簂eader
            if(vte.size()>1)
            
{
                
for(Map.Entry<Integer,Notification> entry:vte.entrySet())
                
{
                    
if(entry.getValue().id>leader)
                        leader
=entry.getKey();
                }

            }

            
return leader;
        }

    }



nianzai 2013-04-17 11:15 鍙戣〃璇勮
]]>
鑴氭湰銆丄jax緗戦〉鍐呭鎶撳彇宸ュ叿(絎簩鐗? http://www.tkk7.com/nianzai/archive/2012/09/29/388838.htmlnianzainianzaiSat, 29 Sep 2012 06:26:00 GMThttp://www.tkk7.com/nianzai/archive/2012/09/29/388838.htmlhttp://www.tkk7.com/nianzai/comments/388838.htmlhttp://www.tkk7.com/nianzai/archive/2012/09/29/388838.html#Feedback1http://www.tkk7.com/nianzai/comments/commentRss/388838.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/388838.html
鍦ㄥ師鏈夌殑鍩虹涓婂鍔?鑷畾涔夊懡浠よ剼鏈?鎶撳彇鍔熻兘銆傝鍔熻兘鑳藉閫氳繃鐢ㄦ埛鑷畾涔夌殑鑴氭湰鏉ュ疄鐜頒笌緗戦〉鐨勪氦浜掞紝姣斿濉啓鍐呭錛岀偣鍑葷綉欏典笂鐨勬彁浜ゆ寜閽?br />榪欐牱渚胯兘鎶撳彇闇瑕佹彁浜ょ殑緗戦〉鍐呭浜嗭紝鐗瑰埆鏄渶瑕佹彁浜ょ殑ajax緗戦〉銆?br />


Ajax銆佽剼鏈綉欏靛唴瀹規姄鍙栧伐鍏?絎簩鐗?  鐐硅繖涓嬭澆


nianzai 2012-09-29 14:26 鍙戣〃璇勮
]]>
闅愰┈鍙か(HMM)涓枃鍒嗚瘝璇嶆ф爣娉ㄧ▼搴?/title><link>http://www.tkk7.com/nianzai/archive/2012/09/14/387740.html</link><dc:creator>nianzai</dc:creator><author>nianzai</author><pubDate>Fri, 14 Sep 2012 09:08:00 GMT</pubDate><guid>http://www.tkk7.com/nianzai/archive/2012/09/14/387740.html</guid><wfw:comment>http://www.tkk7.com/nianzai/comments/387740.html</wfw:comment><comments>http://www.tkk7.com/nianzai/archive/2012/09/14/387740.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/nianzai/comments/commentRss/387740.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/nianzai/services/trackbacks/387740.html</trackback:ping><description><![CDATA[     鎽樿: 鏈殣椹彲澶?HMM)涓枃鍒嗚瘝璇嶆ф爣娉ㄧ▼搴?涓殑 闅愰┈鍙か(HMM)姒傜巼妯″瀷 鏄敱 PFR浜烘皯鏃ユ姤鏍囨敞璇枡199801璇枡搴?鐢熸垚Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->public class HMM{  ...  <a href='http://www.tkk7.com/nianzai/archive/2012/09/14/387740.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/nianzai/aggbug/387740.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/nianzai/" target="_blank">nianzai</a> 2012-09-14 17:08 <a href="http://www.tkk7.com/nianzai/archive/2012/09/14/387740.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏈哄櫒瀛︿範:Viterbi(緇寸壒姣?瀹炵幇紼嬪簭http://www.tkk7.com/nianzai/archive/2012/09/07/387259.htmlnianzainianzaiFri, 07 Sep 2012 08:43:00 GMThttp://www.tkk7.com/nianzai/archive/2012/09/07/387259.htmlhttp://www.tkk7.com/nianzai/comments/387259.htmlhttp://www.tkk7.com/nianzai/archive/2012/09/07/387259.html#Feedback0http://www.tkk7.com/nianzai/comments/commentRss/387259.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/387259.htmlhttp://en.wikipedia.org/wiki/Viterbi_algorithm錛夛紝浣嗘槸3涓瀵熷簭鍒椾細鏍囨敞鍑?涓姸鎬佸簭鍒椼?br />涓嬮潰鏈漢鍐欑殑榪欎釜Viterbi(緇寸壒姣?瀹炵幇紼嬪簭灝辨病榪欎釜闂錛?涓瀵熷簭鍒楀氨鍙爣娉ㄥ嚭3涓姸鎬佸簭鍒椼?div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);">public class Viterbi
{
    
public static void main(String[] args)
    
{
        String[] states 
= {"Rainy""Sunny"};
        String[] observations 
= {"walk""shop""clean"};
        
double[] start_probability = {0.60.4};
        
double[][] transition_probability = {{0.70.3}{0.40.6}};
        
double[][] emission_probability = {{0.10.40.5}{0.60.30.1}};
        forward_viterbi(observations,states,start_probability,transition_probability,emission_probability);
    }

    
    
public static void  forward_viterbi(String[] observations, String[] states,double[] start_probability, double[][] transition_probability, double[][] emission_probability)
    
{
        
int[][] path=new int[observations.length][states.length];
        
double[][] r=new double[observations.length][states.length];
        
for(int j=0;j<states.length;j++)
        
{
            r[
0][j]=start_probability[j]*emission_probability[j][0];
            path[
0][j]=0;
        }

        
        
for(int t=1;t<observations.length;t++)
        
{
            
for(int i=0;i<states.length;i++)
            
{
                
double tmp=0;int m=0;
                
for(int j=0;j<states.length;j++)
                
{
                    
double tem=r[t-1][j]*transition_probability[j][i]*emission_probability[i][t];
                    
if(tem>tmp)
                    
{
                        tmp
=tem;
                        m
=j;
                    }

                }

                r[t][i]
=tmp;
                path[t][i]
=m;
            }

        }

        
        
double p=0;int m=0;
        
for(int i=0;i<r[0].length;i++)
        
{
            
if(r[r.length-1][i]>p)
            
{
                p
=r[r.length-1][i];
                m
=i;
            }

        }

        
        System.out.println(
"p="+p);
        
        
int[] trace=new int[observations.length];
        trace[observations.length
-1]=m;
        
for(int t=observations.length-1;t>0;t--)
        
{
            trace[t
-1]=path[t][m];
            m
=path[t][m];
        }

        
        
for(int i=0;i<trace.length;i++)
            System.out.println(states[trace[i]]);
    }

}
銆?br />


nianzai 2012-09-07 16:43 鍙戣〃璇勮
]]>
鏈澶ф鐜囧垎璇嶇▼搴?/title><link>http://www.tkk7.com/nianzai/archive/2012/08/31/386664.html</link><dc:creator>nianzai</dc:creator><author>nianzai</author><pubDate>Fri, 31 Aug 2012 02:12:00 GMT</pubDate><guid>http://www.tkk7.com/nianzai/archive/2012/08/31/386664.html</guid><wfw:comment>http://www.tkk7.com/nianzai/comments/386664.html</wfw:comment><comments>http://www.tkk7.com/nianzai/archive/2012/08/31/386664.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/nianzai/comments/commentRss/386664.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/nianzai/services/trackbacks/386664.html</trackback:ping><description><![CDATA[     鎽樿: 鏈澶ф鐜囧垎璇嶇▼搴忥紝鍦ㄦ墍鏈夊彲鑳藉垎璇嶈礬寰勪腑閫夋嫨姒傜巼鏈澶х殑涓鏉¤礬寰勬渶涓哄垎璇嶇粨鏋淐ode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->public class MPM extends M{   &...  <a href='http://www.tkk7.com/nianzai/archive/2012/08/31/386664.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/nianzai/aggbug/386664.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/nianzai/" target="_blank">nianzai</a> 2012-08-31 10:12 <a href="http://www.tkk7.com/nianzai/archive/2012/08/31/386664.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鏈鐭礬寰勫垎璇嶇▼搴?/title><link>http://www.tkk7.com/nianzai/archive/2012/08/24/386216.html</link><dc:creator>nianzai</dc:creator><author>nianzai</author><pubDate>Fri, 24 Aug 2012 06:57:00 GMT</pubDate><guid>http://www.tkk7.com/nianzai/archive/2012/08/24/386216.html</guid><wfw:comment>http://www.tkk7.com/nianzai/comments/386216.html</wfw:comment><comments>http://www.tkk7.com/nianzai/archive/2012/08/24/386216.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/nianzai/comments/commentRss/386216.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/nianzai/services/trackbacks/386216.html</trackback:ping><description><![CDATA[ 鏈鐭礬寰勫垎璇嶆硶<div style="padding: 4px 5px 4px 4px; border: 1px solid rgb(204, 204, 204); width: 98%; font-size: 13px; word-break: break-all; background-color: rgb(238, 238, 238);"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" /><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> SPM2 </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> M<br /><img id="Codehighlighter1_28_2603_Open_Image" onclick="this.style.display='none'; Codehighlighter1_28_2603_Open_Text.style.display='none'; Codehighlighter1_28_2603_Closed_Image.style.display='inline'; Codehighlighter1_28_2603_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none;" id="Codehighlighter1_28_2603_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_28_2603_Closed_Text.style.display='none'; Codehighlighter1_28_2603_Open_Image.style.display='inline'; Codehighlighter1_28_2603_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_28_2603_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_28_2603_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">final</span><span style="color: rgb(0, 0, 0);"> HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Character,TreeNode</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> dic </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> Dictionary.loadFreqDictionary(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">sogou.txt</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /><img id="Codehighlighter1_132_173_Open_Image" onclick="this.style.display='none'; Codehighlighter1_132_173_Open_Text.style.display='none'; Codehighlighter1_132_173_Closed_Image.style.display='inline'; Codehighlighter1_132_173_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_132_173_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_132_173_Closed_Text.style.display='none'; Codehighlighter1_132_173_Open_Image.style.display='inline'; Codehighlighter1_132_173_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_132_173_Closed_Text">/** */</span><span id="Codehighlighter1_132_173_Open_Text"><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> 榪斿洖鍙兘鍖歸厤璇嶇殑闀垮害, 娌℃湁鎵懼埌榪斿洖 0.<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />     </span><span style="color: rgb(0, 128, 0);">*/</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> maxMatch(TreeNode node,</span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[] sen, </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> offset) <br /><img id="Codehighlighter1_251_499_Open_Image" onclick="this.style.display='none'; Codehighlighter1_251_499_Open_Text.style.display='none'; Codehighlighter1_251_499_Closed_Image.style.display='inline'; Codehighlighter1_251_499_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_251_499_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_251_499_Closed_Text.style.display='none'; Codehighlighter1_251_499_Open_Image.style.display='inline'; Codehighlighter1_251_499_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_251_499_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_251_499_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> list</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">offset; i</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">sen.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) <br /><img id="Codehighlighter1_347_481_Open_Image" onclick="this.style.display='none'; Codehighlighter1_347_481_Open_Text.style.display='none'; Codehighlighter1_347_481_Closed_Image.style.display='inline'; Codehighlighter1_347_481_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_347_481_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_347_481_Closed_Text.style.display='none'; Codehighlighter1_347_481_Open_Image.style.display='inline'; Codehighlighter1_347_481_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_347_481_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_347_481_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            node </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> node.subNode(sen[i]);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(node </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) <br /><img id="Codehighlighter1_405_457_Open_Image" onclick="this.style.display='none'; Codehighlighter1_405_457_Open_Text.style.display='none'; Codehighlighter1_405_457_Closed_Image.style.display='inline'; Codehighlighter1_405_457_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_405_457_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_405_457_Closed_Text.style.display='none'; Codehighlighter1_405_457_Open_Image.style.display='inline'; Codehighlighter1_405_457_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_405_457_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_405_457_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(node.isAlsoLeaf()) <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                    list.add(i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />            }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> list;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    @Override<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Token</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> getToken(ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Sentence</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> list) <br /><img id="Codehighlighter1_576_1592_Open_Image" onclick="this.style.display='none'; Codehighlighter1_576_1592_Open_Text.style.display='none'; Codehighlighter1_576_1592_Closed_Image.style.display='inline'; Codehighlighter1_576_1592_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_576_1592_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_576_1592_Closed_Text.style.display='none'; Codehighlighter1_576_1592_Open_Image.style.display='inline'; Codehighlighter1_576_1592_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_576_1592_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_576_1592_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Token</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> tokenlist</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Token</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(Sentence sen:list)<br /><img id="Codehighlighter1_658_1569_Open_Image" onclick="this.style.display='none'; Codehighlighter1_658_1569_Open_Text.style.display='none'; Codehighlighter1_658_1569_Closed_Image.style.display='inline'; Codehighlighter1_658_1569_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_658_1569_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_658_1569_Closed_Text.style.display='none'; Codehighlighter1_658_1569_Open_Image.style.display='inline'; Codehighlighter1_658_1569_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_658_1569_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_658_1569_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            AdjList g </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> AdjList(sen.getText().length</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">瀛樺偍鎵鏈夎鍒囧垎鐨勫彲鑳界殑璇?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(i</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">sen.getText().length)<br /><img id="Codehighlighter1_774_1251_Open_Image" onclick="this.style.display='none'; Codehighlighter1_774_1251_Open_Text.style.display='none'; Codehighlighter1_774_1251_Closed_Image.style.display='inline'; Codehighlighter1_774_1251_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_774_1251_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_774_1251_Closed_Text.style.display='none'; Codehighlighter1_774_1251_Open_Image.style.display='inline'; Codehighlighter1_774_1251_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_774_1251_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_774_1251_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                Token token </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Token(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(sen.getText(),i,</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">),i,i</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                token.setWeight(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                g.addEdge(token);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                TreeNode n</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">dic.get(sen.getText()[i]);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(n</span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_955_1237_Open_Image" onclick="this.style.display='none'; Codehighlighter1_955_1237_Open_Text.style.display='none'; Codehighlighter1_955_1237_Closed_Image.style.display='inline'; Codehighlighter1_955_1237_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_955_1237_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_955_1237_Closed_Text.style.display='none'; Codehighlighter1_955_1237_Open_Image.style.display='inline'; Codehighlighter1_955_1237_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_955_1237_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_955_1237_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                    ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> ilist </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">maxMatch(n, sen.getText(),i);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(ilist.size()</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">)<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;j</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">ilist.size();j</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img id="Codehighlighter1_1086_1231_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1086_1231_Open_Text.style.display='none'; Codehighlighter1_1086_1231_Closed_Image.style.display='inline'; Codehighlighter1_1086_1231_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_1086_1231_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1086_1231_Closed_Text.style.display='none'; Codehighlighter1_1086_1231_Open_Image.style.display='inline'; Codehighlighter1_1086_1231_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                        </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_1086_1231_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1086_1231_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                            token </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Token(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(sen.getText(),i,ilist.get(j)</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">i),i,ilist.get(j));<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                            token.setWeight(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                            g.addEdge(token);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />                        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />                }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />            }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">System.out.println(g);</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">            ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> ret</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">maxProb(g);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            Collections.reverse(ret);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> first</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(Integer last:ret)<br /><img id="Codehighlighter1_1392_1565_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1392_1565_Open_Text.style.display='none'; Codehighlighter1_1392_1565_Closed_Image.style.display='inline'; Codehighlighter1_1392_1565_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_1392_1565_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1392_1565_Closed_Text.style.display='none'; Codehighlighter1_1392_1565_Open_Image.style.display='inline'; Codehighlighter1_1392_1565_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_1392_1565_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1392_1565_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                Token token </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Token(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(sen.getText(),first,last</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">first),sen.getStartOffset()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">first,sen.getStartOffset()</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">last);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                tokenlist.add(token);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                first</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">last;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />            }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />        }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> tokenlist;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[] prevNode;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">[] prob;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁$畻鍑鴻礬寰勬渶鐭殑鏁扮粍</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> maxProb(AdjList g)<br /><img id="Codehighlighter1_1692_2066_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1692_2066_Open_Text.style.display='none'; Codehighlighter1_1692_2066_Closed_Image.style.display='inline'; Codehighlighter1_1692_2066_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_1692_2066_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_1692_2066_Closed_Text.style.display='none'; Codehighlighter1_1692_2066_Open_Image.style.display='inline'; Codehighlighter1_1692_2066_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_1692_2066_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_1692_2066_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        prevNode </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[g.verticesNum]; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈浣沖墠椹辮妭鐐?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        prob </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);">[g.verticesNum]; </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鑺傜偣璺緞</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        prob[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鑺傜偣0鐨勫垵濮嬭礬寰勬槸0<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鎸夎妭鐐規眰鏈浣沖墠椹?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">; index </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> g.verticesNum; index</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            getBestPrev(g,index);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">姹傚嚭鏈浣沖墠椹?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> ret </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Integer</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">(g.verticesNum</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);i</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">prevNode[i]) </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 浠庡彸鍚戝乏鎵炬渶浣沖墠椹辮妭鐐?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">            ret.add(i);<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ret;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璁$畻鑺傜偣i鐨勬渶浣沖墠椹辮妭鐐?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> getBestPrev(AdjList g,</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i)<br /><img id="Codehighlighter1_2122_2601_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2122_2601_Open_Text.style.display='none'; Codehighlighter1_2122_2601_Closed_Image.style.display='inline'; Codehighlighter1_2122_2601_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_2122_2601_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2122_2601_Closed_Text.style.display='none'; Codehighlighter1_2122_2601_Open_Image.style.display='inline'; Codehighlighter1_2122_2601_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_2122_2601_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_2122_2601_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        Iterator</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Token</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> it </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> g.getPrev(i);</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">寰楀埌鍓嶉┍璇嶉泦鍚堬紝浠庝腑鎸戦夋渶浣沖墠瓚嬭瘝</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> maxProb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1000</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> maxNode </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        <br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);">(it.hasNext())<br /><img id="Codehighlighter1_2252_2538_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2252_2538_Open_Text.style.display='none'; Codehighlighter1_2252_2538_Closed_Image.style.display='inline'; Codehighlighter1_2252_2538_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_2252_2538_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2252_2538_Closed_Text.style.display='none'; Codehighlighter1_2252_2538_Open_Image.style.display='inline'; Codehighlighter1_2252_2538_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_2252_2538_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_2252_2538_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            Token itr </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> it.next();<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 0, 255);">double</span><span style="color: rgb(0, 0, 0);"> nodeProb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> prob[itr.getStart()]</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">itr.getWeight();</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鍊欓夎妭鐐硅礬寰?br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />            </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">System.out.println(itr.getWord()+","+nodeProb);</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">              </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (nodeProb </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> maxProb)</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">璺緞鏈鐭殑綆椾綔鏈浣沖墠瓚?/span><span style="color: rgb(0, 128, 0);"><br /><img id="Codehighlighter1_2459_2533_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2459_2533_Open_Text.style.display='none'; Codehighlighter1_2459_2533_Closed_Image.style.display='inline'; Codehighlighter1_2459_2533_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none;" id="Codehighlighter1_2459_2533_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_2459_2533_Closed_Text.style.display='none'; Codehighlighter1_2459_2533_Open_Image.style.display='inline'; Codehighlighter1_2459_2533_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif"></span><span style="color: rgb(0, 0, 0);">              </span><span style="border: 1px solid rgb(128, 128, 128); display: none; background-color: rgb(255, 255, 255);" id="Codehighlighter1_2459_2533_Closed_Text"><img alt="" src="http://www.tkk7.com/Images/dot.gif" /></span><span id="Codehighlighter1_2459_2533_Open_Text"><span style="color: rgb(0, 0, 0);">{<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                  maxNode </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> itr.getStart();<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />                  maxProb </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> nodeProb;<br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />              }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" />         }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" />        prob[i] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> maxProb;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鑺傜偣璺緞</span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" /></span><span style="color: rgb(0, 0, 0);">        prevNode[i] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> maxNode;</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">鏈浣沖墠椹辮妭鐐?/span><span style="color: rgb(0, 128, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" /></span><span style="color: rgb(0, 0, 0);">    }</span></span><span style="color: rgb(0, 0, 0);"><br /><img alt="" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" />}</span></span></div><br /><br /> <img src ="http://www.tkk7.com/nianzai/aggbug/386216.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/nianzai/" target="_blank">nianzai</a> 2012-08-24 14:57 <a href="http://www.tkk7.com/nianzai/archive/2012/08/24/386216.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏ㄥ垏鍒嗗垎璇嶇▼搴?鑳藉疄鐜頒腑鑻辨枃鏁板瓧娣峰悎鍒嗚瘝http://www.tkk7.com/nianzai/archive/2012/07/02/381988.htmlnianzainianzaiMon, 02 Jul 2012 06:17:00 GMThttp://www.tkk7.com/nianzai/archive/2012/07/02/381988.htmlhttp://www.tkk7.com/nianzai/comments/381988.htmlhttp://www.tkk7.com/nianzai/archive/2012/07/02/381988.html#Feedback4http://www.tkk7.com/nianzai/comments/commentRss/381988.htmlhttp://www.tkk7.com/nianzai/services/trackbacks/381988.html
鑳藉疄鐜頒腑鑻辨枃鏁板瓧娣峰悎鍒嗚瘝銆傛瘮濡傝兘鍒嗗嚭榪欐牱鐨勮瘝錛歜b闇溿?瀹ゃ佷箰phone銆乼ouch4銆乵p3銆乀鎭ゃ?br />
public class FMW extends M
{
    
public static final HashMap<Character,TreeNode> dic = Dictionary.getFmmdic();
    
    
/**
     * 
@return 榪斿洖鍙兘鍖歸厤璇嶇殑闀垮害, 娌℃湁鎵懼埌榪斿洖 0.
     
*/

    
public ArrayList<Integer> maxMatch(TreeNode node,char[] sen, int offset) 
    
{
        ArrayList
<Integer> list=new ArrayList<Integer>();
        
for(int i=offset; i<sen.length; i++
        
{
            node 
= node.subNode(sen[i]);
            
if(node != null
            
{
                
if(node.isAlsoLeaf()) 
                    list.add(i
+1);
            }

            
else 
                
break;
        }

        
if(list.size()==0)
            list.add(offset);
        
return list;
    }

    
    
public ArrayList<Token> getToken(ArrayList<Sentence> list)
    
{
        ArrayList
<Token> tokenlist=new ArrayList<Token>();
        
for(Sentence sen:list)
        
{
            
int i=0;
            
while(i<sen.getText().length)
            
{
                TreeNode n
=dic.get(sen.getText()[i]);
                
if(n!=null)
                
{
                    ArrayList
<Integer> ilist =maxMatch(n, sen.getText(),i);
                    
if(ilist.size()>1)
                    
{
                        
for(int j=0;j<ilist.size();j++)
                        
{
                            Token token 
= new Token(new String(sen.getText(),i,ilist.get(j)-i),sen.getStartOffset()+i,sen.getStartOffset()+ilist.get(j));
                            tokenlist.add(token);
                        }

                    }

                    
else
                    
{
                        
if(ilist.get(0)>i)
                        
{
                            Token token 
= new Token(new String(sen.getText(),i,ilist.get(0)-i),sen.getStartOffset()+i,sen.getStartOffset()+ilist.get(0));
                            tokenlist.add(token);
                        }

                        
else
                        
{
                            
if(tokenlist.size()==0 || tokenlist.get(tokenlist.size()-1).getEnd()<=i+sen.getStartOffset())
                            
{
                                Token token 
= new Token(new String(sen.getText(),i,1),sen.getStartOffset()+i,sen.getStartOffset()+i+1);
                                tokenlist.add(token);
                            }

                        }

                    }

                }

                
else
                
{
                    
if(tokenlist.size()==0 || tokenlist.get(tokenlist.size()-1).getEnd()<=i+sen.getStartOffset())
                    
{
                        Token token 
= new Token(new String(sen.getText(),i,1),sen.getStartOffset()+i,sen.getStartOffset()+i+1);
                        tokenlist.add(token);
                    }

                }

                i
++;
            }

        }

        
return tokenlist;
    }

}





nianzai 2012-07-02 14:17 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 一级做a爱片特黄在线观看免费看 一级做a爱过程免费视 | 成人毛片18女人毛片免费96| 18禁成人网站免费观看| 七色永久性tv网站免费看| 两个人看的www免费| 久久国产美女免费观看精品 | 亚洲成人免费电影| 亚洲国产精品专区| 亚洲av无码专区在线| 精品丝袜国产自在线拍亚洲| 亚洲www在线观看| 蜜臀亚洲AV无码精品国产午夜.| 日韩色视频一区二区三区亚洲| 国产精品亚洲精品久久精品| 精品一区二区三区无码免费直播| 特级毛片A级毛片免费播放| 特级一级毛片免费看| 三级黄色免费观看| 99久久精品免费精品国产| 五月亭亭免费高清在线| 四虎国产精品免费久久| 国产成人免费高清在线观看| av无码东京热亚洲男人的天堂| 久久精品国产亚洲7777| 亚洲国产精品无码专区在线观看| 91久久亚洲国产成人精品性色 | 亚洲成人动漫在线观看| 亚洲色大成网站WWW国产| 香蕉国产在线观看免费| 日本免费人成网ww555在线| 真人做A免费观看| 国产zzjjzzjj视频全免费| 亚洲午夜精品久久久久久浪潮| 亚洲国产精品无码久久SM| 亚洲日本香蕉视频| 国产亚洲视频在线| 日本免费人成网ww555在线| 处破痛哭A√18成年片免费| 亚洲国产成人精品久久久国产成人一区二区三区综 | 亚洲AV无码乱码在线观看裸奔| 亚洲人成在线播放|