Examples of Match


Examples of org.apache.stanbol.enhancer.engines.keywordextraction.impl.Suggestion.MATCH

            }
            labelIndex--;
        }
        //Now we make a second round to search tokens that match in the wrong order
        //e.g. if given and family name of persons are switched
        MATCH labelMatch;
        int coveredTokens = lastFoundIndex-firstFoundIndex+1;
        float labelMatchScore = (foundTokenMatch/(float)labelTokens.length);
        //Matching rules
        // - if less than config#minTokenFound() than accept only EXACT
        // - override PARTIAL matches with FULL/EXACT matches only if
        //   foundTokens of the PARTIAL match is > than of the FULL/EXACT
        //   match (this will be very rare
        if(foundProcessableTokens > 0 && match.getMatchCount() <= foundProcessableTokens) {
            String currentText = state.getTokenText(firstFoundIndex,coveredTokens);
            if(config.isCaseSensitiveMatching() ? currentText.equals(text) : currentText.equalsIgnoreCase(text)){
                labelMatch = MATCH.EXACT;
                //set found to covered: May be lower because only
                //processable tokens are counted, but Exact also checks
                //of non-processable!
                foundTokens = coveredTokens;
            } else if((foundProcessableTokens >= config.getMinFoundTokens() ||
                    //NOTE (rwesten, 2012-05-21): Do not check if all covered
                    //  Tokens are found, but if all Tokens of the Label are
                    //  matched! (STANBOL-622)
                    //foundTokens == coveredTokens) &&
                    foundTokens >= labelTokens.length) &&
                    labelMatchScore >= 0.6f){
                //same as above
                //if(foundTokens == coveredTokens){
                if(foundTokens == labelTokens.length && foundTokens == coveredTokens){
                    labelMatch = MATCH.FULL;
                } else {
                    labelMatch = MATCH.PARTIAL;
                }
            } else {
                labelMatch = MATCH.NONE;
            }
            if(labelMatch != MATCH.NONE){
                if(match.getMatchCount() < foundProcessableTokens ||
                        match.getMatchCount() == foundProcessableTokens &&
                        labelMatch.ordinal() > match.getMatch().ordinal()){
                    match.updateMatch(labelMatch, firstFoundIndex, coveredTokens, foundTokens,
                        foundTokenMatch/foundTokens,label,labelTokens.length);
                } //else this match is not better as the existing one
            } //else ignore labels with MATCH.NONE
        } //else NO tokens found -> nothing to do
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.keywordextraction.linking.Suggestion.MATCH

            }
            labelIndex--;
        }
        //Now we make a second round to search tokens that match in the wrong order
        //e.g. if given and family name of persons are switched
        MATCH labelMatch;
        int coveredTokens = lastFoundIndex-firstFoundIndex+1;
        float labelMatchScore = (foundTokenMatch/(float)labelTokens.length);
        //Matching rules
        // - if less than config#minTokenFound() than accept only EXACT
        // - override PARTIAL matches with FULL/EXACT matches only if
        //   foundTokens of the PARTIAL match is > than of the FULL/EXACT
        //   match (this will be very rare
        if(foundProcessableTokens > 0 && match.getMatchCount() <= foundProcessableTokens) {
            String currentText = state.getTokenText(firstFoundIndex,coveredTokens);
            if(config.isCaseSensitiveMatching() ? currentText.equals(text) : currentText.equalsIgnoreCase(text)){
                labelMatch = MATCH.EXACT;
                //set found to covered: May be lower because only
                //processable tokens are counted, but Exact also checks
                //of non-processable!
                foundTokens = coveredTokens;
            } else if((foundProcessableTokens >= config.getMinFoundTokens() ||
                    foundTokens == coveredTokens) &&
                    labelMatchScore >= 0.6f){
                if(foundTokens == coveredTokens){
                    labelMatch = MATCH.FULL;
                } else {
                    labelMatch = MATCH.PARTIAL;
                }
            } else {
                labelMatch = MATCH.NONE;
            }
            if(labelMatch != MATCH.NONE){
                if(match.getMatchCount() < foundProcessableTokens ||
                        match.getMatchCount() == foundProcessableTokens &&
                        labelMatch.ordinal() > match.getMatch().ordinal()){
                    match.updateMatch(labelMatch, firstFoundIndex, coveredTokens, foundTokens,
                        foundTokenMatch/foundTokens,label,labelTokens.length);
                } //else this match is not better as the existing one
            } //else ignore labels with MATCH.NONE
        } //else NO tokens found -> nothing to do
View Full Code Here

Examples of org.apache.tapestry.ioc.annotations.Match

        // TODO: Check that at least one parameter is type java.lang.Object,
        // since that's how the delegate is passed in.

        Order orderAnnotation = method.getAnnotation(Order.class);
        Match match = method.getAnnotation(Match.class);

        String[] constraints = orderAnnotation != null ? orderAnnotation.value() : null;

        // TODO: Validate constraints here?

        String[] patterns = match == null ? new String[]
        { decoratorId } : match.value();

        DecoratorDef def = new DecoratorDefImpl(decoratorId, method, patterns, constraints,
                _classFactory);

        _decoratorDefs.put(decoratorId, def);
View Full Code Here

Examples of org.apache.tapestry5.ioc.annotations.Match

        decoratorDefs.put(decoratorId, def);
    }

    private String[] extractPatterns(String id, Method method)
    {
        Match match = method.getAnnotation(Match.class);

        if (match == null)
            return new String[]
            { id };

        return match.value();
    }
View Full Code Here

Examples of org.apache.xerces.impl.validation.datatypes.regex.Match

            iConstraint = ((Number)constraint) . intValue();
         }
      } catch (ClassCastException e) {
         return null;
      }
      Match m = new Match();
      if ( ! decodeNonIntegerRE . matches( s , m ) ) {
         return null;
      }
      int scale = m . getCapturedText( 2 ) . length();
      if ( scale > iConstraint ) {
         return null;
      }
      return new Integer( scale );
   }
View Full Code Here

Examples of org.apache.xerces.impl.xpath.regex.Match

    String s = content;
    final RegularExpression regexPattern = makePatternXerces(pattern, flags);
    if (regexPattern == null)
      return s;
    else {
      Match m = new Match();
      if(regexPattern.matches(s,m)){
        String result = "";
        while(regexPattern.matches(s,m)){
          int numberOfGroups = m.getNumberOfGroups();
          if(numberOfGroups>0){
            String interReplacement = new String(replacement);
            if(numberOfGroups>1){
              for(int i=numberOfGroups-1; i>0; i--){ // start at the end to not have problems that $1 is replaced for a string $10 but $10 should be replaced (the same leading prefixes!)
                int start = m.getBeginning(i);
                int end = m.getEnd(i);               
                String r = (start>=0 && end>=0)?s.substring(start, end):"";
                interReplacement=interReplacement.replaceFirst("[$]"+i, r);
              }
            }
            result+=s.substring(0, m.getBeginning(0))+interReplacement;
            s=s.substring(m.getEnd(0));
          }
        }
        return result+s;
      } else return s;
    }
View Full Code Here

Examples of org.apache.xmlbeans.impl.regex.Match

     */
    public static String[] split(String source, String delimPattern)
    {
        ArrayList result = new ArrayList(3);
        RegularExpression re = new RegularExpression(delimPattern);
        Match matcher = new Match();

        if (re.matches(source, matcher))
        {
            int groups = matcher.getNumberOfGroups();
            int start = 0;
            for (int i = 0; i < groups; i++)
            {
                result.add(source.substring(start, matcher.getBeginning(i)));
                start = matcher.getEnd(i);
            }
            result.add(source.substring(start));
        }
        else
        {
View Full Code Here

Examples of org.boris.expr.function.excel.MATCH

        assertResult(c, "LOOKUP(7.66,A2:A6,B2:B6)", "blue");
        assertResult(c, "LOOKUP(0,A2:A6,B2:B6)", ExprError.NA);
    }

    public void testMATCH() throws Exception {
        MATCH m = new MATCH();
        fail("MATCH not implemented");
    }
View Full Code Here

Examples of org.drools.planner.examples.travelingtournament.domain.Match

                for (ListIterator<Day> secondDayIt = dayList.listIterator(firstDayIt.nextIndex()); secondDayIt.hasNext();) {
                    Day secondDay = secondDayIt.next();
                    List<Match> clonedFirstDayMatchList = new ArrayList<Match>(firstDayTeamMap.values());
                    while (!clonedFirstDayMatchList.isEmpty()) {
                        List<Match> rotateList = new ArrayList<Match>(4);
                        Match startMatch = clonedFirstDayMatchList.remove(0);
                        boolean otherInFirst = false;
                        rotateList.add(startMatch);
                        Team startHomeTeam = startMatch.getHomeTeam();
                        Team nextTeamToFind = startMatch.getAwayTeam();
                        while (!startHomeTeam.equals(nextTeamToFind)) {
                            Map<Team, Match> subTeamMap = dayTeamMap.get(otherInFirst ? firstDay : secondDay);
                            Match repairMatch = subTeamMap.get(nextTeamToFind);
                            if (otherInFirst) {
                                clonedFirstDayMatchList.remove(repairMatch);
                            }
                            rotateList.add(repairMatch);
                            nextTeamToFind = getOtherTeam(repairMatch, nextTeamToFind);
View Full Code Here

Examples of org.drools.planner.examples.travelingtournament.domain.Match

                    List<Match> clonedFirstTeamMatchList = new ArrayList<Match>(firstTeamDayMap.values());
                    while (!clonedFirstTeamMatchList.isEmpty()) {
                        List<Match> firstRotateList = new ArrayList<Match>();
                        List<Match> secondRotateList = new ArrayList<Match>();

                        Match firstStartMatch = clonedFirstTeamMatchList.remove(0);
                        Team firstStartTeam = getOtherTeam(firstStartMatch, firstTeam);
                        Day startDay = firstStartMatch.getDay();
                        boolean firstTeamIsHomeTeam = firstStartMatch.getHomeTeam().equals(firstTeam);
                        Match secondStartMatch = teamDayMap.get(secondTeam).get(startDay);
                        if (firstStartMatch.equals(secondStartMatch)) {
                            break;
                        }
                        firstRotateList.add(0, firstStartMatch);
                        secondRotateList.add(secondStartMatch);
                        Map<Team, Match> visitedTeamMap = new HashMap<Team, Match>();

                        Team teamToFind = getOtherTeam(secondStartMatch, secondTeam);

                        while (!teamToFind.equals(firstStartTeam)) {
//                            boolean shortcut = visitedTeamMap.containsKey(teamToFind);
//                            if (shortcut) {
                            Match firstRepairMatch = homeTeamAwayTeamMap
                                    .get(firstTeamIsHomeTeam ? firstTeam : teamToFind)
                                    .get(firstTeamIsHomeTeam ? teamToFind : firstTeam);
                            if (!clonedFirstTeamMatchList.contains(firstRepairMatch)) {
                                if (visitedTeamMap.containsKey(teamToFind)) {
                                    // shortcut splitoff is possible
                                    Match shortcutMatch = visitedTeamMap.get(teamToFind);
                                    int shortcutSize = firstRotateList.indexOf(shortcutMatch) + 1;
                                    int reverseShortcutSize = firstRotateList.size() - shortcutSize;
                                    List<Match> firstShortcutRotateList = new ArrayList<Match>(
                                            firstRotateList.subList(0, shortcutSize));
                                    for (Match match : firstShortcutRotateList) {
                                        visitedTeamMap.remove(getOtherTeam(match, firstTeam));
                                    }
                                    List<Match> secondShortcutRotateList = new ArrayList<Match>(
                                            secondRotateList.subList(reverseShortcutSize, secondRotateList.size()));
                                    firstRotateList = new ArrayList<Match>(
                                            firstRotateList.subList(shortcutSize, firstRotateList.size()));
                                    secondRotateList = new ArrayList<Match>(
                                            secondRotateList.subList(0, reverseShortcutSize));
                                    addTeamRotateMove(moveList, firstShortcutRotateList, secondShortcutRotateList);
                                }
                                firstTeamIsHomeTeam = !firstTeamIsHomeTeam;
//                            Team firstRepairHomeTeam = (firstTeamIsHomeTeam ^ shortcut) ? firstTeam : teamToFind;
//                            Team firstRepairAwayTeam = (firstTeamIsHomeTeam ^ shortcut) ? teamToFind : firstTeam;
//                            Match firstRepairMatch = homeTeamAwayTeamMap
//                                    .get(firstRepairHomeTeam).get(firstRepairAwayTeam);
                                firstRepairMatch = homeTeamAwayTeamMap
                                        .get(firstTeamIsHomeTeam ? firstTeam : teamToFind)
                                        .get(firstTeamIsHomeTeam ? teamToFind : firstTeam);
                            }

                            Day repairDay = firstRepairMatch.getDay();
                            Match secondRepairMatch = teamDayMap.get(secondTeam).get(repairDay);
                            clonedFirstTeamMatchList.remove(firstRepairMatch);
                            visitedTeamMap.put(teamToFind, firstRepairMatch);
                            firstRotateList.add(0, firstRepairMatch);
                            secondRotateList.add(secondRepairMatch);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.