/*
 * SDK Pullenti Lingvo, version 4.33, fabruary 2026. Copyright (c) 2013-2026, Pullenti. All rights reserved. 
 * Non-Commercial Freeware and Commercial Software.
 * This class is generated using the converter Unisharping (www.unisharping.ru) from Pullenti C# project. 
 * The latest version of the code is available on the site www.pullenti.ru
 */

package com.pullenti.ner.address.internal;

public class AddressItemToken extends com.pullenti.ner.MetaToken {

    public AddressItemToken(AddressItemType _typ, com.pullenti.ner.Token begin, com.pullenti.ner.Token end) {
        super(begin, end, null);
        setTyp(_typ);
    }

    public AddressItemType getTyp() {
        return m_Typ;
    }

    public AddressItemType setTyp(AddressItemType _value) {
        m_Typ = _value;
        if (_value == AddressItemType.HOUSE) {
        }
        return _value;
    }


    private AddressItemType m_Typ = AddressItemType.PREFIX;

    public String value;

    public com.pullenti.ner.Referent referent;

    public com.pullenti.ner.ReferentToken refToken;

    public com.pullenti.ner.Referent referent2;

    public com.pullenti.ner.ReferentToken refToken2;

    public boolean refTokenIsGsk;

    public boolean refTokenIsMassive;

    public boolean isDoubt;

    public boolean isGenplan;

    public com.pullenti.ner.address.AddressDetailType detailType = com.pullenti.ner.address.AddressDetailType.UNDEFINED;

    public com.pullenti.ner.address.AddressBuildingType buildingType = com.pullenti.ner.address.AddressBuildingType.UNDEFINED;

    public com.pullenti.ner.address.AddressHouseType houseType = com.pullenti.ner.address.AddressHouseType.UNDEFINED;

    public int detailMeters = 0;

    public String detailParam;

    public AddressItemToken ortoTerr;

    public AddressItemToken areaTerr;

    public AddressItemToken altTyp;

    public AddressItemToken next;

    public AddressItemToken clone() {
        AddressItemToken res = new AddressItemToken(getTyp(), getBeginToken(), getEndToken());
        res.setMorph(this.getMorph());
        res.value = value;
        res.referent = referent;
        res.refToken = refToken;
        res.referent2 = referent2;
        res.refToken2 = refToken2;
        res.refTokenIsGsk = refTokenIsGsk;
        res.refTokenIsMassive = refTokenIsMassive;
        res.isDoubt = isDoubt;
        res.detailType = detailType;
        res.buildingType = buildingType;
        res.houseType = houseType;
        res.detailMeters = detailMeters;
        res.detailParam = detailParam;
        res.isGenplan = isGenplan;
        if (ortoTerr != null) 
            res.ortoTerr = ortoTerr.clone();
        if (areaTerr != null) 
            res.areaTerr = areaTerr.clone();
        if (altTyp != null) 
            res.altTyp = altTyp.clone();
        if (next != null) 
            res.next = next.clone();
        return res;
    }

    public boolean isStreetRoad() {
        if (getTyp() != AddressItemType.STREET) 
            return false;
        if (!(referent instanceof com.pullenti.ner.address.StreetReferent)) 
            return false;
        return ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(referent, com.pullenti.ner.address.StreetReferent.class)).getKind() == com.pullenti.ner.address.StreetKind.ROAD;
    }


    public boolean isStreetDetail() {
        if (getTyp() != AddressItemType.STREET) 
            return false;
        if (!(referent instanceof com.pullenti.ner.address.StreetReferent)) 
            return false;
        for (String s : referent.getStringValues("MISC")) {
            if ((s.indexOf("бизнес") >= 0) || (s.indexOf("делов") >= 0) || (s.indexOf("офис") >= 0)) 
                return true;
        }
        return false;
    }


    public boolean isDigit() {
        if (com.pullenti.unisharp.Utils.stringsEq(value, "Б/Н") || com.pullenti.unisharp.Utils.stringsEq(value, "НЕТ")) 
            return true;
        if (com.pullenti.unisharp.Utils.isNullOrEmpty(value)) 
            return false;
        if (Character.isDigit(value.charAt(0)) || value.charAt(0) == '-') 
            return true;
        if (value.length() > 1) {
            if (Character.isLetter(value.charAt(0)) && Character.isDigit(value.charAt(1))) 
                return true;
        }
        if (value.length() != 1 || !Character.isLetter(value.charAt(0))) 
            return false;
        if (!getBeginToken().chars.isAllLower()) 
            return false;
        return true;
    }


    public boolean isHouse() {
        return (getTyp() == AddressItemType.HOUSE || getTyp() == AddressItemType.PLOT || getTyp() == AddressItemType.BOX) || getTyp() == AddressItemType.BUILDING || getTyp() == AddressItemType.CORPUS;
    }


    @Override
    public String toString() {
        StringBuilder res = new StringBuilder();
        res.append(this.getTyp().toString()).append(" ").append(((value != null ? value : "")));
        if (referent != null) 
            res.append(" <").append(referent.toString()).append(">");
        if (referent2 != null) 
            res.append(" / <").append(referent2.toString()).append(">");
        if (detailType != com.pullenti.ner.address.AddressDetailType.UNDEFINED || detailMeters > 0) 
            res.append(" [").append(detailType.toString()).append(", ").append(detailMeters).append("]");
        if (ortoTerr != null) 
            res.append(" TERR: ").append(ortoTerr);
        if (areaTerr != null) 
            res.append(" AREA: ").append(areaTerr);
        if (altTyp != null) 
            res.append(" ALT: ").append(altTyp);
        if (refToken != null) 
            res.append(" REFTOKEN: ").append(refToken.toString());
        if (refToken2 != null) 
            res.append(" REFTOKEN2: ").append(refToken2.toString());
        if (next != null) 
            res.append(" Next: ").append(next.toString());
        return res.toString();
    }

    private static AddressItemToken _findAddrTyp(com.pullenti.ner.Token t, int maxChar, int lev) {
        if (t == null || t.getEndChar() > maxChar) 
            return null;
        if (lev > 5) 
            return null;
        if (t instanceof com.pullenti.ner.ReferentToken) {
            com.pullenti.ner.geo.GeoReferent geo = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(t.getReferent(), com.pullenti.ner.geo.GeoReferent.class);
            if (geo != null) {
                for (com.pullenti.ner.Slot s : geo.getSlots()) {
                    if (com.pullenti.unisharp.Utils.stringsEq(s.getTypeName(), com.pullenti.ner.geo.GeoReferent.ATTR_TYPE)) {
                        String ty = s.getValue().toString();
                        if ((ty.indexOf("район") >= 0)) 
                            return null;
                    }
                }
            }
            for (com.pullenti.ner.Token tt = ((com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.ReferentToken.class)).getBeginToken(); tt != null && tt.getEndChar() <= t.getEndChar(); tt = tt.getNext()) {
                if (tt.getEndChar() > maxChar) 
                    break;
                if (tt.isValue("У", null)) {
                    if (geo.findSlot(com.pullenti.ner.geo.GeoReferent.ATTR_TYPE, "улус", true) != null) 
                        continue;
                }
                AddressItemToken ty = _findAddrTyp(tt, maxChar, lev + 1);
                if (ty != null) {
                    if (ty.getBeginToken() == ty.getEndToken() && tt.isValue("РАЙОН", null)) {
                        if (tt.getEndChar() == t.getEndChar()) 
                            continue;
                        if (tt.getNext() != null && tt.getNext().isComma()) 
                            continue;
                    }
                    return ty;
                }
            }
        }
        else {
            AddressItemToken ai = _tryAttachDetail(t, null);
            if (ai != null) {
                if (ai.detailType != com.pullenti.ner.address.AddressDetailType.UNDEFINED || ai.detailMeters > 0) 
                    return ai;
            }
        }
        return null;
    }

    public static AddressItemToken tryParse(com.pullenti.ner.Token t, boolean prefixBefore, AddressItemToken prev, com.pullenti.ner.geo.internal.GeoAnalyzerData ad) {
        if (t == null) 
            return null;
        if (ad == null) 
            ad = com.pullenti.ner.geo.GeoAnalyzer.getData(t);
        if (ad == null) 
            return null;
        if (ad.aLevel > 1) 
            return null;
        ad.aLevel++;
        AddressItemToken res = _TryParse(t, prefixBefore, prev, ad);
        ad.aLevel--;
        if ((res == null && t.isValue("З", null) && (t.getNext() instanceof com.pullenti.ner.NumberToken)) && prev != null && prev.getTyp() == AddressItemType.STREET) {
            AddressItemToken num = tryParsePureItem(t.getNext(), null, null);
            if (num != null && num.getTyp() == AddressItemType.NUMBER) 
                res = _new84(AddressItemType.HOUSE, t, num.getEndToken(), num.value);
        }
        if (((res != null && !res.isWhitespaceAfter() && res.getEndToken().getNext() != null) && ((res.getEndToken().getNext().isHiphen() || res.getEndToken().getNext().isCharOf("\\/"))) && !res.getEndToken().getNext().isWhitespaceAfter()) && res.value != null) {
            if ((res.getTyp() == AddressItemType.HOUSE || res.getTyp() == AddressItemType.BUILDING || res.getTyp() == AddressItemType.CORPUS) || res.getTyp() == AddressItemType.PLOT) {
                com.pullenti.ner.Token tt = res.getEndToken().getNext().getNext();
                AddressItemToken _next = tryParsePureItem(tt, null, null);
                if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                    res = res.clone();
                    res.value = (res.value + (res.getEndToken().getNext().isHiphen() ? "-" : "/") + _next.value);
                    res.setEndToken(_next.getEndToken());
                    tt = res.getEndToken().getNext();
                    if ((tt != null && ((tt.isHiphen() || tt.isCharOf("\\/"))) && !tt.isWhitespaceBefore()) && !tt.isWhitespaceAfter()) {
                        _next = tryParsePureItem(tt.getNext(), null, null);
                        if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                            res.value = (res.value + (tt.isHiphen() ? "-" : "/") + _next.value);
                            res.setEndToken(_next.getEndToken());
                        }
                    }
                }
                else if ((tt instanceof com.pullenti.ner.TextToken) && tt.getLengthChar() == 1 && tt.chars.isAllUpper()) {
                    res.value = (res.value + "-" + ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term);
                    res.setEndToken(tt);
                }
            }
        }
        return res;
    }

    private static AddressItemToken _TryParse(com.pullenti.ner.Token t, boolean prefixBefore, AddressItemToken prev, com.pullenti.ner.geo.internal.GeoAnalyzerData ad) {
        if (t == null) 
            return null;
        if (t instanceof com.pullenti.ner.ReferentToken) {
            com.pullenti.ner.ReferentToken rt = (com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.ReferentToken.class);
            AddressItemType ty;
            com.pullenti.ner.geo.GeoReferent geo = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(rt.referent, com.pullenti.ner.geo.GeoReferent.class);
            if ((geo != null && t.getNext() != null && t.getNext().isHiphen()) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
                java.util.ArrayList<StreetItemToken> sit = StreetItemToken.tryParseSpec(t, null);
                if (sit != null && sit.get(0).typ == StreetItemType.NAME) 
                    geo = null;
                else if (t.getNext().getNext() != null && (t.getNext().getNext().getReferent() instanceof com.pullenti.ner.geo.GeoReferent)) 
                    geo = null;
            }
            if (geo != null) {
                if (geo.isCity()) 
                    ty = AddressItemType.CITY;
                else if (geo.isState()) 
                    ty = AddressItemType.COUNTRY;
                else 
                    ty = AddressItemType.REGION;
                AddressItemToken res = _new85(ty, t, t, rt.referent);
                if (ty != AddressItemType.CITY) 
                    return res;
                for (com.pullenti.ner.Token tt = ((com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.ReferentToken.class)).getBeginToken(); tt != null && tt.getEndChar() <= t.getEndChar(); tt = tt.getNext()) {
                    if (tt instanceof com.pullenti.ner.ReferentToken) {
                        if (tt.getReferent() == geo) {
                            AddressItemToken res1 = _TryParse(tt, false, prev, ad);
                            if (res1 != null && ((res1.detailMeters > 0 || res1.detailType != com.pullenti.ner.address.AddressDetailType.UNDEFINED))) {
                                res1.setBeginToken(res1.setEndToken(t));
                                return res1;
                            }
                        }
                        continue;
                    }
                    AddressItemToken det = _tryParsePureItem(tt, false, null);
                    if (det != null) {
                        if (tt.isValue("У", null) && geo.findSlot(com.pullenti.ner.geo.GeoReferent.ATTR_TYPE, "улус", true) != null) {
                        }
                        else {
                            if (det.detailType != com.pullenti.ner.address.AddressDetailType.UNDEFINED && res.detailType == com.pullenti.ner.address.AddressDetailType.UNDEFINED) 
                                res.detailType = det.detailType;
                            if (det.detailMeters > 0) 
                                res.detailMeters = det.detailMeters;
                        }
                    }
                }
                return res;
            }
        }
        boolean kvart = false;
        if (prev != null) {
            if (t.isValue("КВ", null) || t.isValue("КВАРТ", null)) {
                if ((((prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.NUMBER || prev.getTyp() == AddressItemType.BUILDING) || prev.getTyp() == AddressItemType.FLOOR || prev.getTyp() == AddressItemType.POTCH) || prev.getTyp() == AddressItemType.CORPUS || prev.getTyp() == AddressItemType.CORPUSORFLAT) || prev.getTyp() == AddressItemType.DETAIL) 
                    return tryParsePureItem(t, prev, null);
                kvart = true;
            }
        }
        if (prev != null && ((t.isValue("П", null) || t.isValue("ПОЗ", null) || t.isValue("ПОЗИЦИЯ", null)))) {
            if ((com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t) || prev.getTyp() == AddressItemType.STREET || prev.getTyp() == AddressItemType.CITY) || prev.getTyp() == AddressItemType.GENPLAN || prev.getTyp() == AddressItemType.PLOT) {
                com.pullenti.ner.Token tt = t.getNext();
                if (tt != null && tt.isChar('.')) 
                    tt = tt.getNext();
                AddressItemToken _next = tryParsePureItem(tt, null, null);
                if (_next != null && ((_next.getTyp() == AddressItemType.NUMBER || _next.getTyp() == AddressItemType.GENPLAN))) {
                    _next = _next.clone();
                    _next.setBeginToken(t);
                    _next.isGenplan = true;
                    _next.setTyp(AddressItemType.NUMBER);
                    if (t.getLengthChar() == 1 && (((prev.getTyp() == AddressItemType.NUMBER || prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.BUILDING) || prev.getTyp() == AddressItemType.CORPUS || prev.getTyp() == AddressItemType.FLAT))) {
                        _next.setTyp(AddressItemType.SPACE);
                        _next.isGenplan = false;
                    }
                    return _next;
                }
            }
        }
        AddressItemToken pure = tryParsePureItem(t, prev, ad);
        if ((pure != null && pure.getTyp() != AddressItemType.NUMBER && pure.getTyp() != AddressItemType.KILOMETER) && pure.value != null) {
            if (t.isValue("СТ", null) && com.pullenti.ner.geo.internal.OrgItemToken.tryParse(t, null) != null) {
            }
            else if (kvart) {
                com.pullenti.ner.Token ttt = pure.getEndToken().getNext();
                if (ttt != null && ttt.isComma()) 
                    ttt = ttt.getNext();
                AddressItemToken _next = tryParsePureItem(ttt, null, null);
                if (_next != null && _next.getTyp() == AddressItemType.PLOT) {
                }
                else 
                    return pure;
            }
            else 
                return pure;
        }
        com.pullenti.ner.Token tt2 = com.pullenti.ner.geo.internal.MiscLocationHelper.checkTerritory(t);
        if (tt2 != null) {
            AddressItemToken _next = tryParse(tt2.getNext(), false, null, null);
            if (_next != null && _next.getTyp() == AddressItemType.STREET) {
                com.pullenti.ner.address.StreetReferent ss = (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(_next.referent, com.pullenti.ner.address.StreetReferent.class);
                if (ss.getKind() == com.pullenti.ner.address.StreetKind.ROAD || ss.getKind() == com.pullenti.ner.address.StreetKind.RAILWAY) {
                    _next.setBeginToken(t);
                    return _next;
                }
            }
        }
        if (t.isValue("ТРК", null)) {
        }
        java.util.ArrayList<StreetItemToken> sli = StreetItemToken.tryParseList(t, 10, ad);
        if (sli != null) {
            AddressItemToken rt = StreetDefineHelper.tryParseStreet(sli, prefixBefore || ((prev != null && prev.detailType == com.pullenti.ner.address.AddressDetailType.CROSS)), false, prev != null && prev.getTyp() == AddressItemType.STREET, null, false);
            if (rt == null && sli.get(0).typ != StreetItemType.FIX) {
                com.pullenti.ner.geo.internal.OrgItemToken _org = com.pullenti.ner.geo.internal.OrgItemToken.tryParse(t, null);
                if (_org != null && !_org.isBuilding) {
                    StreetItemToken si = StreetItemToken._new86(t, _org.getEndToken(), StreetItemType.FIX, _org);
                    sli.clear();
                    sli.add(si);
                    rt = StreetDefineHelper.tryParseStreet(sli, prefixBefore || prev != null, false, false, null, false);
                }
                else if (sli.size() == 1 && sli.get(0).typ == StreetItemType.NOUN && !sli.get(0).isNewlineAfter()) {
                    _org = com.pullenti.ner.geo.internal.OrgItemToken.tryParse(sli.get(0).getEndToken().getNext(), null);
                    if (_org != null) {
                        String _typ = sli.get(0).termin.getCanonicText().toLowerCase();
                        StreetItemToken si = StreetItemToken._new86(t, _org.getEndToken(), StreetItemType.FIX, _org);
                        sli.clear();
                        sli.add(si);
                        rt = StreetDefineHelper.tryParseStreet(sli, prefixBefore || prev != null, false, false, null, false);
                        if (rt != null && (rt.referent instanceof com.pullenti.ner.address.StreetReferent)) {
                            com.pullenti.ner.address.StreetReferent sr = (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(rt.referent, com.pullenti.ner.address.StreetReferent.class);
                            sr.addSlot(com.pullenti.ner.address.StreetReferent.ATTR_TYPE, null, true, 0);
                            sr.addTyp(_typ);
                            sr.setKind(com.pullenti.ner.address.StreetKind.UNDEFINED);
                        }
                    }
                    else if ((prev != null && prev.getTyp() == AddressItemType.CITY && (sli.get(0).getEndToken().getNext() instanceof com.pullenti.ner.ReferentToken)) && (sli.get(0).getEndToken().getNext().getReferent() instanceof com.pullenti.ner.geo.GeoReferent)) {
                        com.pullenti.ner.ReferentToken rt0 = (com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(sli.get(0).getEndToken().getNext(), com.pullenti.ner.ReferentToken.class);
                        StreetItemToken st1 = StreetItemToken.tryParse(rt0.getBeginToken(), sli.get(0), false, null);
                        if (st1 != null && st1.getEndChar() == rt0.getEndChar()) {
                            java.util.ArrayList<StreetItemToken> sli1 = new java.util.ArrayList<StreetItemToken>();
                            sli1.add(sli.get(0));
                            sli1.add(st1);
                            rt = StreetDefineHelper.tryParseStreet(sli1, prefixBefore, false, (prev != null && prev.getTyp() == AddressItemType.STREET), null, false);
                            if (rt != null) 
                                rt.setEndToken(rt0);
                        }
                    }
                }
            }
            if ((rt == null && prev != null && ((prev.getTyp() == AddressItemType.CITY || prev.getTyp() == AddressItemType.REGION))) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(sli.get(0))) {
                if (sli.size() == 1 && !sli.get(0).isNewlineBefore() && (((sli.get(0).typ == StreetItemType.NAME || sli.get(0).typ == StreetItemType.STDNAME || sli.get(0).typ == StreetItemType.STDADJECTIVE) || ((sli.get(0).typ == StreetItemType.NUMBER && sli.get(0).getBeginToken().getMorph()._getClass().isAdjective()))))) 
                    rt = StreetDefineHelper.tryParseStreet(sli, true, false, false, null, false);
            }
            if (((rt == null && prev != null && prev.getTyp() == AddressItemType.STREET) && sli.size() == 1 && sli.get(0).typ == StreetItemType.NAME) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(sli.get(0))) {
                boolean ok1 = false;
                if (prev.refToken != null) 
                    ok1 = true;
                else if ((prev.referent instanceof com.pullenti.ner.address.StreetReferent) && ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(prev.referent, com.pullenti.ner.address.StreetReferent.class)).getKind() == com.pullenti.ner.address.StreetKind.AREA) 
                    ok1 = true;
                else if (AddressItemToken.checkHouseAfter(sli.get(0).getEndToken().getNext(), false, false)) 
                    ok1 = true;
                if (ok1) 
                    rt = StreetDefineHelper.tryParseStreet(sli, true, false, false, null, false);
            }
            if (rt != null) {
                if (sli.size() > 2) {
                }
                if (rt.getBeginChar() > sli.get(0).getBeginChar()) 
                    return null;
                boolean crlf = false;
                for (com.pullenti.ner.Token ttt = rt.getBeginToken(); ttt != rt.getEndToken() && (ttt.getEndChar() < rt.getEndChar()); ttt = ttt.getNext()) {
                    if (ttt.isNewlineAfter()) {
                        crlf = true;
                        break;
                    }
                }
                if (crlf) {
                    for (com.pullenti.ner.Token ttt = rt.getBeginToken().getPrevious(); ttt != null; ttt = ttt.getPrevious()) {
                        if (ttt.getMorph()._getClass().isPreposition() || ttt.isComma()) 
                            continue;
                        if (ttt.getReferent() instanceof com.pullenti.ner.geo.GeoReferent) 
                            crlf = false;
                        break;
                    }
                    if (sli.get(0).typ == StreetItemType.NOUN && (sli.get(0).termin.getCanonicText().indexOf("ДОРОГА") >= 0)) 
                        crlf = false;
                }
                if (crlf) {
                    com.pullenti.ner.Token tt33 = rt.getEndToken().getNext();
                    if (tt33 != null && tt33.isComma()) 
                        tt33 = tt33.getNext();
                    AddressItemToken aat = tryParsePureItem(tt33, null, null);
                    if (aat == null) 
                        return null;
                    if (aat.getTyp() != AddressItemType.HOUSE) 
                        return null;
                }
                if (rt.getEndToken().getNext() != null && rt.getEndToken().getNext().isCharOf("\\/")) {
                    if (!AddressItemToken.checkHouseAfter(rt.getEndToken().getNext().getNext(), false, false)) {
                        java.util.ArrayList<StreetItemToken> sli2 = StreetItemToken.tryParseList(rt.getEndToken().getNext().getNext(), 10, ad);
                        if (sli2 != null && sli2.size() > 0) {
                            AddressItemToken rt2 = StreetDefineHelper.tryParseStreet(sli2, prefixBefore, false, true, (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(rt.referent, com.pullenti.ner.address.StreetReferent.class), false);
                            if (rt2 != null) {
                                rt.setEndToken(rt2.getEndToken());
                                rt.referent2 = rt2.referent;
                            }
                        }
                    }
                }
                return rt;
            }
            if (sli.size() == 1 && sli.get(0).typ == StreetItemType.NOUN) {
                com.pullenti.ner.Token tt = sli.get(0).getEndToken().getNext();
                if (tt != null && ((tt.isHiphen() || tt.isChar('_') || tt.isValue("НЕТ", null)))) {
                    com.pullenti.ner.Token ttt = tt.getNext();
                    if (ttt != null && ttt.isComma()) 
                        ttt = ttt.getNext();
                    AddressItemToken att = tryParsePureItem(ttt, null, null);
                    if (att != null) {
                        if (att.getTyp() == AddressItemType.HOUSE || att.getTyp() == AddressItemType.CORPUS || att.getTyp() == AddressItemType.BUILDING) 
                            return new AddressItemToken(AddressItemType.STREET, t, tt);
                    }
                }
            }
            if ((sli.size() == 1 && sli.get(0).typ == StreetItemType.NAME && prev != null) && prev.getTyp() == AddressItemType.CITY && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(sli.get(0))) {
                com.pullenti.ner.Token tt3 = sli.get(0).getEndToken().getNext();
                for (; tt3 != null; tt3 = tt3.getNext()) {
                    if (!tt3.isCharOf(",.")) 
                        break;
                }
                if (AddressItemToken.checkStreetAfter(tt3, false)) {
                    com.pullenti.ner.geo.GeoReferent rr = new com.pullenti.ner.geo.GeoReferent();
                    rr.addSlot(com.pullenti.ner.geo.GeoReferent.ATTR_NAME, com.pullenti.ner.core.MiscHelper.getTextValueOfMetaToken(sli.get(0), com.pullenti.ner.core.GetTextAttr.NO), false, 0);
                    rr.setHigher((com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(prev.referent, com.pullenti.ner.geo.GeoReferent.class));
                    return _new88(AddressItemType.REGION, sli.get(0).getBeginToken(), sli.get(0).getEndToken(), rr, new com.pullenti.ner.ReferentToken(rr, sli.get(0).getBeginToken(), sli.get(0).getEndToken(), null));
                }
            }
        }
        if (t == null || pure != null) 
            return pure;
        if ((t.getLengthChar() == 1 && t.chars.isLetter() && prev != null) && prev.getTyp() == AddressItemType.CITY && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
            com.pullenti.ner.Token tt = t.getNext();
            if (tt != null && tt.isHiphen()) 
                tt = tt.getNext();
            String ch = correctCharToken(t);
            if ((tt instanceof com.pullenti.ner.NumberToken) && ch != null) {
                com.pullenti.ner.address.StreetReferent micr = new com.pullenti.ner.address.StreetReferent();
                micr.addTyp("микрорайон");
                micr.addSlot(com.pullenti.ner.address.StreetReferent.ATTR_NUMBER, (((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.NumberToken.class)).getValue() + ch), false, 0);
                micr.setKind(com.pullenti.ner.address.StreetKind.AREA);
                return _new88(AddressItemType.STREET, t, tt, micr, new com.pullenti.ner.ReferentToken(micr, t, tt, null));
            }
        }
        return null;
    }

    public static boolean SPEEDREGIME = false;

    public static void prepareAllData(com.pullenti.ner.Token t0) {
        if (!SPEEDREGIME) 
            return;
        com.pullenti.ner.geo.internal.GeoAnalyzerData ad = com.pullenti.ner.geo.GeoAnalyzer.getData(t0);
        if (ad == null) 
            return;
        ad.aRegime = false;
        for (com.pullenti.ner.Token t = t0; t != null; t = t.getNext()) {
            com.pullenti.ner.geo.internal.GeoTokenData d = (com.pullenti.ner.geo.internal.GeoTokenData)com.pullenti.unisharp.Utils.cast(t.tag, com.pullenti.ner.geo.internal.GeoTokenData.class);
            AddressItemToken prev = null;
            int kk = 0;
            for (com.pullenti.ner.Token tt = t.getPrevious(); tt != null && (kk < 10); tt = tt.getPrevious(),kk++) {
                com.pullenti.ner.geo.internal.GeoTokenData dd = (com.pullenti.ner.geo.internal.GeoTokenData)com.pullenti.unisharp.Utils.cast(tt.tag, com.pullenti.ner.geo.internal.GeoTokenData.class);
                if (dd == null) 
                    continue;
                if (dd.street != null) {
                    if (dd.street.getEndToken().getNext() == t) 
                        prev = dd.addr;
                    else if (t.getPrevious() != null && t.getPrevious().isComma() && dd.street.getEndToken().getNext() == t.getPrevious()) 
                        prev = dd.addr;
                }
                else if (dd.addr != null && (((dd.addr.getTyp() == AddressItemType.HOUSE || dd.addr.getTyp() == AddressItemType.FLAT || dd.addr.getTyp() == AddressItemType.CORPUS) || dd.addr.getTyp() == AddressItemType.BUILDING))) {
                    if (dd.addr.getEndToken().getNext() == t) 
                        prev = dd.addr;
                    else if (t.getPrevious() != null && t.getPrevious().isComma() && dd.addr.getEndToken().getNext() == t.getPrevious()) 
                        prev = dd.addr;
                }
            }
            AddressItemToken str = tryParsePureItem(t, prev, null);
            if (str != null) {
                if (d == null) 
                    d = new com.pullenti.ner.geo.internal.GeoTokenData(t);
                d.addr = str;
            }
        }
        ad.aRegime = true;
    }

    public static boolean checkStreetAfter(com.pullenti.ner.Token t, boolean checkThisAndNotNext) {
        int cou = 0;
        for (; t != null && (cou < 4); t = t.getNext(),cou++) {
            if (t.isCharOf(",.") || t.isHiphen() || t.getMorph()._getClass().isPreposition()) {
            }
            else 
                break;
        }
        if (t == null) 
            return false;
        AddressItemToken ait = tryParse(t, false, null, null);
        if (ait == null || ait.getTyp() != AddressItemType.STREET) 
            return false;
        if (ait.refToken != null) {
            if (!ait.refTokenIsGsk) 
                return false;
            com.pullenti.ner.geo.internal.OrgItemToken oo = (com.pullenti.ner.geo.internal.OrgItemToken)com.pullenti.unisharp.Utils.cast(ait.refToken, com.pullenti.ner.geo.internal.OrgItemToken.class);
            if (oo != null && oo.isDoubt) 
                return false;
        }
        if (!checkThisAndNotNext) 
            return true;
        if (t.getNext() == null || ait.getEndChar() <= t.getEndChar()) 
            return true;
        AddressItemToken ait2 = tryParse(t.getNext(), false, null, null);
        if (ait2 == null) 
            return true;
        java.util.ArrayList<AddressItemToken> aits1 = tryParseList(t, 20);
        java.util.ArrayList<AddressItemToken> aits2 = tryParseList(t.getNext(), 20);
        if (aits1 != null && aits2 != null) {
            if (aits2.get(aits2.size() - 1).getEndChar() > aits1.get(aits1.size() - 1).getEndChar()) 
                return false;
        }
        return true;
    }

    public static boolean checkHouseAfter(com.pullenti.ner.Token t, boolean leek, boolean pureHouse) {
        if (t == null) 
            return false;
        int cou = 0;
        for (; t != null && (cou < 4); t = t.getNext(),cou++) {
            if (t.isCharOf(",.") || t.getMorph()._getClass().isPreposition()) {
            }
            else 
                break;
        }
        if (t == null) 
            return false;
        if (t.isNewlineBefore() && t.getPrevious() != null) 
            return false;
        AddressItemToken ait = tryParsePureItem(t, null, null);
        if (ait != null) {
            if (ait.getTyp() == AddressItemType.NONUMBER) 
                return true;
            if (ait.value == null || com.pullenti.unisharp.Utils.stringsEq(ait.value, "0")) 
                return false;
            if (pureHouse) 
                return ait.getTyp() == AddressItemType.HOUSE || ait.getTyp() == AddressItemType.PLOT;
            if (((ait.getTyp() == AddressItemType.HOUSE || ait.getTyp() == AddressItemType.FLOOR || ait.getTyp() == AddressItemType.OFFICE) || ait.getTyp() == AddressItemType.FLAT || ait.getTyp() == AddressItemType.PLOT) || ait.getTyp() == AddressItemType.ROOM || ait.getTyp() == AddressItemType.CORPUS) {
                if (((t instanceof com.pullenti.ner.TextToken) && t.chars.isAllUpper() && t.getNext() != null) && t.getNext().isHiphen() && (t.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
                    return false;
                if ((t instanceof com.pullenti.ner.TextToken) && t.getNext() == ait.getEndToken() && t.getNext().isHiphen()) 
                    return false;
                return true;
            }
            if (leek) {
                if (ait.getTyp() == AddressItemType.NUMBER) 
                    return true;
            }
            if (ait.getTyp() == AddressItemType.NUMBER) {
                com.pullenti.ner.Token t1 = t.getNext();
                while (t1 != null && t1.isCharOf(".,")) {
                    t1 = t1.getNext();
                }
                ait = tryParsePureItem(t1, null, null);
                if (ait != null && ((((ait.getTyp() == AddressItemType.BUILDING || ait.getTyp() == AddressItemType.CORPUS || ait.getTyp() == AddressItemType.FLAT) || ait.getTyp() == AddressItemType.FLOOR || ait.getTyp() == AddressItemType.OFFICE) || ait.getTyp() == AddressItemType.ROOM))) 
                    return true;
            }
        }
        return false;
    }

    public static boolean checkKmAfter(com.pullenti.ner.Token t) {
        int cou = 0;
        for (; t != null && (cou < 4); t = t.getNext(),cou++) {
            if (t.isCharOf(",.") || t.getMorph()._getClass().isPreposition()) {
            }
            else 
                break;
        }
        if (t == null) 
            return false;
        AddressItemToken km = tryParsePureItem(t, null, null);
        if (km != null && km.getTyp() == AddressItemType.KILOMETER) 
            return true;
        if (!(t instanceof com.pullenti.ner.NumberToken) || t.getNext() == null) 
            return false;
        if (t.getNext().isValue("КИЛОМЕТР", null) || t.getNext().isValue("МЕТР", null) || t.getNext().isValue("КМ", null)) 
            return true;
        return false;
    }

    public static boolean checkKmBefore(com.pullenti.ner.Token t) {
        int cou = 0;
        for (; t != null && (cou < 4); t = t.getPrevious(),cou++) {
            if (t.isCharOf(",.")) {
            }
            else if (t.isValue("КМ", null) || t.isValue("КИЛОМЕТР", null) || t.isValue("МЕТР", null)) 
                return true;
        }
        return false;
    }

    public static char correctChar(char v) {
        if (v == 'A' || v == 'А') 
            return 'А';
        if (v == 'Б' || v == 'Г') 
            return v;
        if (v == 'B' || v == 'В') 
            return 'В';
        if (v == 'C' || v == 'С') 
            return 'С';
        if (v == 'D' || v == 'Д') 
            return 'Д';
        if (v == 'E' || v == 'Е') 
            return 'Е';
        if (v == 'H' || v == 'Н') 
            return 'Н';
        if (v == 'K' || v == 'К') 
            return 'К';
        return (char)0;
    }

    private static String correctCharToken(com.pullenti.ner.Token t) {
        com.pullenti.ner.TextToken tt = (com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.TextToken.class);
        if (tt == null) 
            return null;
        String v = tt.term;
        if (v.length() == 1) {
            char corr = correctChar(v.charAt(0));
            if (corr != ((char)0)) 
                return (String.valueOf(corr));
            if (t.chars.isCyrillicLetter()) 
                return v;
        }
        if (v.length() == 2) {
            if (t.chars.isCyrillicLetter()) 
                return v;
            char corr = correctChar(v.charAt(0));
            char corr2 = correctChar(v.charAt(1));
            if (corr != ((char)0) && corr2 != ((char)0)) 
                return (String.valueOf(corr) + corr2);
        }
        return null;
    }

    private static String _corrNumber(String num) {
        if (com.pullenti.unisharp.Utils.isNullOrEmpty(num)) 
            return null;
        if (num.charAt(0) != 'З') 
            return null;
        String res = "3";
        int i;
        for (i = 1; i < num.length(); i++) {
            if (num.charAt(i) == 'З') 
                res += "3";
            else if (num.charAt(i) == 'О') 
                res += "0";
            else 
                break;
        }
        if (i == num.length()) 
            return res;
        if ((i + 1) < num.length()) 
            return null;
        if (num.charAt(i) == 'А' || num.charAt(i) == 'Б' || num.charAt(i) == 'В') 
            return (res + num.charAt(i));
        return null;
    }

    public static com.pullenti.ner.ReferentToken createAddress(String txt) {
        com.pullenti.ner.AnalysisResult ar = null;
        try {
            ar = com.pullenti.ner.ProcessorService.getEmptyProcessor().process(com.pullenti.ner.SourceOfAnalysis._new90(txt, "ADDRESS"), null, null);
        } catch (Exception ex) {
            return null;
        }
        if (ar == null) 
            return null;
        prepareAllData(ar.firstToken);
        java.util.ArrayList<AddressItemToken> li = new java.util.ArrayList<AddressItemToken>();
        for (com.pullenti.ner.Token t = ar.firstToken; t != null; t = t.getNext()) {
            if (t.isCharOf(",.")) 
                continue;
            AddressItemToken ait = tryParsePureItem(t, (li.size() > 0 ? li.get(li.size() - 1) : null), null);
            if (ait == null) 
                break;
            li.add(ait);
            t = ait.getEndToken();
        }
        if (li == null || li.size() == 0) 
            return null;
        com.pullenti.ner.Token rt = AddressDefineHelper.tryDefine(li, ar.firstToken, null, true);
        return (com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(rt, com.pullenti.ner.ReferentToken.class);
    }

    public static java.util.ArrayList<AddressItemToken> tryParseList(com.pullenti.ner.Token t, int maxCount) {
        if (t == null) 
            return null;
        com.pullenti.ner.geo.internal.GeoAnalyzerData ad = com.pullenti.ner.geo.GeoAnalyzer.getData(t);
        if (ad != null) {
            if (ad.level > 0) 
                return null;
            ad.level++;
        }
        java.util.ArrayList<AddressItemToken> res = tryParseListInt(t, maxCount);
        if (ad != null) 
            ad.level--;
        if (res != null && res.size() == 0) 
            return null;
        return res;
    }

    private static java.util.ArrayList<AddressItemToken> tryParseListInt(com.pullenti.ner.Token t, int maxCount) {
        if (t instanceof com.pullenti.ner.NumberToken) {
            if (((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class)).getIntValue() == null) 
                return null;
            int v = ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class)).getIntValue();
            if ((v < 100000) || v >= 10000000) {
                if (((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class)).typ == com.pullenti.ner.NumberSpellingType.DIGIT && !t.getMorph()._getClass().isAdjective()) {
                    if (t.getNext() == null || (t.getNext() instanceof com.pullenti.ner.NumberToken)) {
                        if (t.getPrevious() == null || !t.getPrevious().getMorph()._getClass().isPreposition()) 
                            return null;
                    }
                }
            }
        }
        AddressItemToken it = tryParse(t, false, null, null);
        if (it == null) 
            return null;
        if (it.getTyp() == AddressItemType.NUMBER) 
            return null;
        if (it.detailType == com.pullenti.ner.address.AddressDetailType.ORG || ((it.isHouse() && com.pullenti.unisharp.Utils.stringsEq(it.value, "0")))) {
            if (!com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it)) 
                return null;
        }
        if (it.getTyp() == AddressItemType.KILOMETER && (it.getBeginToken().getPrevious() instanceof com.pullenti.ner.NumberToken)) {
            it = it.clone();
            it.setBeginToken(it.getBeginToken().getPrevious());
            it.value = ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(it.getBeginToken(), com.pullenti.ner.NumberToken.class)).getValue().toString();
            if (it.getBeginToken().getPrevious() != null && it.getBeginToken().getPrevious().getMorph()._getClass().isPreposition()) 
                it.setBeginToken(it.getBeginToken().getPrevious());
        }
        if (it.getTyp() == AddressItemType.STREET && it.refToken != null && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it)) 
            return null;
        java.util.ArrayList<AddressItemToken> res = new java.util.ArrayList<AddressItemToken>();
        res.add(it);
        while (it.altTyp != null) {
            res.add(it.altTyp);
            it = it.altTyp;
        }
        boolean pref = it.getTyp() == AddressItemType.PREFIX;
        for (t = it.getEndToken().getNext(); t != null; t = t.getNext()) {
            if (maxCount > 0 && res.size() >= maxCount) 
                break;
            AddressItemToken last = res.get(res.size() - 1);
            if (res.size() > 1) {
                if (last.isNewlineBefore() && res.get(res.size() - 2).getTyp() != AddressItemType.PREFIX) {
                    int i;
                    for (i = 0; i < (res.size() - 1); i++) {
                        if (res.get(i).getTyp() == last.getTyp()) {
                            if (i == (res.size() - 2) && ((last.getTyp() == AddressItemType.CITY || last.getTyp() == AddressItemType.REGION))) {
                                int jj;
                                for (jj = 0; jj < i; jj++) {
                                    if ((res.get(jj).getTyp() != AddressItemType.PREFIX && res.get(jj).getTyp() != AddressItemType.ZIP && res.get(jj).getTyp() != AddressItemType.REGION) && res.get(jj).getTyp() != AddressItemType.COUNTRY) 
                                        break;
                                }
                                if (jj >= i) 
                                    continue;
                            }
                            break;
                        }
                    }
                    if ((i < (res.size() - 1)) || last.getTyp() == AddressItemType.ZIP) {
                        res.remove(last);
                        break;
                    }
                }
            }
            if (t.isTableControlChar()) 
                break;
            if (t.isChar(',') || t.isChar('|')) 
                continue;
            if (t.isValue("ДУБЛЬ", null)) 
                continue;
            if (t.isCharOf("\\/")) {
                if (t.isNewlineBefore() || t.isNewlineAfter()) 
                    break;
                if (t.getPrevious() != null && t.getPrevious().isComma()) 
                    continue;
                if (last.getTyp() == AddressItemType.STREET && last.isDoubt) 
                    break;
                res.add((it = _new91(AddressItemType.DETAIL, t, t, com.pullenti.ner.address.AddressDetailType.CROSS)));
                continue;
            }
            if (t.isChar(':') && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) 
                continue;
            if (t.isChar(';') && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t) && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamGarAddress(t)) 
                continue;
            if (com.pullenti.ner.core.BracketHelper.isBracket(t, false) && t.getNext() != null && t.getNext().isComma()) 
                continue;
            if (t.isChar('.')) {
                if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) 
                    continue;
                if (t.isNewlineAfter()) {
                    if (last.getTyp() == AddressItemType.CITY) {
                        AddressItemToken _next = tryParse(t.getNext(), false, null, null);
                        if (_next != null && _next.getTyp() == AddressItemType.STREET) 
                            continue;
                    }
                    break;
                }
                if (t.getPrevious() != null && t.getPrevious().isChar('.')) {
                    if (t.getPrevious().getPrevious() != null && t.getPrevious().getPrevious().isChar('.')) 
                        break;
                }
                continue;
            }
            if (t.isHiphen() || t.isChar('_')) {
                if (((it.getTyp() == AddressItemType.NUMBER || it.getTyp() == AddressItemType.STREET)) && (t.getNext() instanceof com.pullenti.ner.NumberToken)) 
                    continue;
                if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it)) 
                    continue;
                if (it.getTyp() == AddressItemType.CITY) 
                    continue;
            }
            if (it.getTyp() == AddressItemType.DETAIL && it.detailType == com.pullenti.ner.address.AddressDetailType.CROSS) {
                AddressItemToken str1 = tryParse(t, true, null, null);
                if (str1 != null && str1.getTyp() == AddressItemType.STREET) {
                    if (str1.getEndToken().getNext() != null && ((str1.getEndToken().getNext().isAnd() || str1.getEndToken().getNext().isHiphen()))) {
                        AddressItemToken str2 = tryParse(str1.getEndToken().getNext().getNext(), true, null, null);
                        if (str2 == null || str2.getTyp() != AddressItemType.STREET) {
                            str2 = StreetDefineHelper.tryParseSecondStreet(str1.getBeginToken(), str1.getEndToken().getNext().getNext());
                            if (str2 != null && str2.isDoubt) {
                                str2 = str2.clone();
                                str2.isDoubt = false;
                            }
                        }
                        if (str2 != null && str2.getTyp() == AddressItemType.STREET) {
                            res.add(str1);
                            res.add(str2);
                            t = str2.getEndToken();
                            it = str2;
                            continue;
                        }
                    }
                }
            }
            boolean pre = pref;
            if (it.getTyp() == AddressItemType.KILOMETER || ((it.getTyp() == AddressItemType.HOUSE && it.value != null && ((res.size() == 1 || res.get(res.size() - 2).getTyp() != AddressItemType.STREET))))) {
                if (!t.isNewlineBefore()) 
                    pre = true;
            }
            if (t.isValue2("НЕ", "УКАЗАН") || t.isValue2("НЕ", "ЗАДАН")) {
                t = t.getNext();
                continue;
            }
            AddressItemToken it0 = tryParse(t, pre, it, null);
            if (it0 == null) {
                boolean hous = false;
                com.pullenti.unisharp.Outargwrapper<Boolean> wraphous93 = new com.pullenti.unisharp.Outargwrapper<Boolean>();
                com.pullenti.ner.Token tt = gotoEndOfAddress(t.getPrevious(), wraphous93);
                hous = (wraphous93.value != null ? wraphous93.value : false);
                if (tt != null && tt.getEndChar() >= t.getEndChar() && tt.getNext() != null) {
                    if (tt.getNext().isComma()) 
                        tt = tt.getNext();
                    it0 = tryParse(tt.getNext(), pre, it, null);
                    if (it0 == null && hous && it.getTyp() == AddressItemType.STREET) 
                        res.add(_new84(AddressItemType.HOUSE, t, tt, "0"));
                }
                if (it.getTyp() == AddressItemType.CITY) {
                    StreetItemToken sit = StreetItemToken.tryParse(t, null, false, null);
                    if (sit != null && sit.typ == StreetItemType.NOUN && com.pullenti.unisharp.Utils.stringsEq(sit.termin.getCanonicText(), "УЛИЦА")) {
                        if (AddressItemToken.checkHouseAfter(sit.getEndToken().getNext(), false, false)) {
                            t = sit.getEndToken();
                            continue;
                        }
                    }
                }
            }
            if (it0 == null && t.getMorphClassInDictionary().isPreposition() && (t.getWhitespacesAfterCount() < 3)) {
                it0 = tryParse(t.getNext(), pre, it, null);
                if (it0 != null) {
                    if (it0.getTyp() == AddressItemType.NUMBER) 
                        it0 = null;
                    else if (it0.getTyp() == AddressItemType.BUILDING && t.getNext().isValue("СТ", null)) 
                        it0 = null;
                    else {
                        it0 = it0.clone();
                        it0.setBeginToken(t);
                    }
                }
            }
            if (it0 == null) {
                if (com.pullenti.ner.core.BracketHelper.canBeEndOfSequence(t, true, null, false) && last.getTyp() == AddressItemType.STREET) 
                    continue;
                if (t.isCharOf("\\/") && last.getTyp() == AddressItemType.STREET) 
                    continue;
            }
            if (((it0 == null && t.isChar('(') && (t.getNext() instanceof com.pullenti.ner.ReferentToken)) && (t.getNext().getReferent() instanceof com.pullenti.ner.geo.GeoReferent) && t.getNext().getNext() != null) && t.getNext().getNext().isChar(')')) {
                it0 = tryParse(t.getNext(), pre, it, null);
                if (it0 != null) {
                    it0 = it0.clone();
                    it0.setBeginToken(t);
                    it0.setEndToken(it0.getEndToken().getNext());
                    com.pullenti.ner.geo.GeoReferent geo0 = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(t.getNext().getReferent(), com.pullenti.ner.geo.GeoReferent.class);
                    if (geo0.getHigher() == null) {
                        for (int kk = res.size() - 1; kk >= 0; kk--) {
                            if (res.get(kk).getTyp() == AddressItemType.CITY && (res.get(kk).referent instanceof com.pullenti.ner.geo.GeoReferent)) {
                                if (com.pullenti.ner.geo.internal.GeoOwnerHelper.canBeHigher((com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(kk).referent, com.pullenti.ner.geo.GeoReferent.class), geo0, null, null) || ((geo0.findSlot(com.pullenti.ner.geo.GeoReferent.ATTR_TYPE, "город", true) != null && res.get(kk).referent.findSlot(com.pullenti.ner.geo.GeoReferent.ATTR_TYPE, "город", true) != null))) {
                                    geo0.setHigher((com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(kk).referent, com.pullenti.ner.geo.GeoReferent.class));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            if (it0 == null) {
                if (t.getNewlinesBeforeCount() > 2) 
                    break;
                if (it.getTyp() == AddressItemType.POSTOFFICEBOX) 
                    break;
                if (t.isHiphen() && t.getNext() != null && t.getNext().isComma()) 
                    continue;
                if (t.isHiphen() && (t.getNext() instanceof com.pullenti.ner.NumberToken) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) 
                    continue;
                if (t.isValue("НЕТ", null) || t.isValue("ТЕР", null) || t.isValue("ТЕРРИТОРИЯ", null)) 
                    continue;
                if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
                    if ((t.isValue("РАСПОЛОЖЕННЫЙ", null) || t.isValue("НЕЖИЛОЙ", null) || t.isValue("ЗДАНИЕ", null)) || t.isValue("ЧАСТЬ", null)) 
                        continue;
                    if (((t.isValue("ПЛ", null) || t.isValue("ПЛОЩАДЬ", null) || t.isValue("ПЛОЩ", null))) && t.getNext() != null) {
                        com.pullenti.ner.core.NumberExToken nn = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix((t.getNext() instanceof com.pullenti.ner.NumberToken ? t.getNext() : t.getNext().getNext()));
                        if (nn != null && nn.exTyp == com.pullenti.ner.core.NumberExType.METER2) {
                            t = nn.getEndToken();
                            continue;
                        }
                    }
                }
                com.pullenti.ner.Token tt1 = StreetItemToken.checkStdName(t);
                if (tt1 != null) {
                    t = tt1;
                    continue;
                }
                if (t.getMorph()._getClass().isPreposition()) {
                    it0 = tryParse(t.getNext(), false, it, null);
                    if (it0 != null && it0.getTyp() == AddressItemType.BUILDING && it0.getBeginToken().isValue("СТ", null)) {
                        it0 = null;
                        break;
                    }
                    if (it0 != null) {
                        if ((it0.getTyp() == AddressItemType.DETAIL && it.getTyp() == AddressItemType.CITY && it.detailMeters > 0) && it.detailType == com.pullenti.ner.address.AddressDetailType.UNDEFINED) {
                            it.detailType = it0.detailType;
                            t = it.setEndToken(it0.getEndToken());
                            continue;
                        }
                        if ((it0.getTyp() == AddressItemType.HOUSE || it0.getTyp() == AddressItemType.BUILDING || it0.getTyp() == AddressItemType.CORPUS) || it0.getTyp() == AddressItemType.STREET || it0.getTyp() == AddressItemType.DETAIL) {
                            res.add((it = it0));
                            t = it.getEndToken();
                            continue;
                        }
                    }
                }
                if (it.getTyp() == AddressItemType.HOUSE || it.getTyp() == AddressItemType.BUILDING || it.getTyp() == AddressItemType.NUMBER) {
                    if ((!t.isWhitespaceBefore() && t.getLengthChar() == 1 && t.chars.isLetter()) && !t.isWhitespaceAfter() && (t.getNext() instanceof com.pullenti.ner.NumberToken)) {
                        String ch = correctCharToken(t);
                        if (com.pullenti.unisharp.Utils.stringsEq(ch, "К") || com.pullenti.unisharp.Utils.stringsEq(ch, "С")) {
                            it0 = _new84((com.pullenti.unisharp.Utils.stringsEq(ch, "К") ? AddressItemType.CORPUS : AddressItemType.BUILDING), t, t.getNext(), ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t.getNext(), com.pullenti.ner.NumberToken.class)).getValue().toString());
                            it = it0;
                            res.add(it);
                            t = it.getEndToken();
                            com.pullenti.ner.Token tt = t.getNext();
                            if (((tt != null && !tt.isWhitespaceBefore() && tt.getLengthChar() == 1) && tt.chars.isLetter() && !tt.isWhitespaceAfter()) && (tt.getNext() instanceof com.pullenti.ner.NumberToken)) {
                                ch = correctCharToken(tt);
                                if (com.pullenti.unisharp.Utils.stringsEq(ch, "К") || com.pullenti.unisharp.Utils.stringsEq(ch, "С")) {
                                    it = _new84((com.pullenti.unisharp.Utils.stringsEq(ch, "К") ? AddressItemType.CORPUS : AddressItemType.BUILDING), tt, tt.getNext(), ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(tt.getNext(), com.pullenti.ner.NumberToken.class)).getValue().toString());
                                    res.add(it);
                                    t = it.getEndToken();
                                }
                            }
                            continue;
                        }
                    }
                }
                if (t.getMorph()._getClass().isPreposition()) {
                    if ((((t.isValue("У", null) || t.isValue("ВОЗЛЕ", null) || t.isValue("НАПРОТИВ", null)) || t.isValue("НА", null) || t.isValue("В", null)) || t.isValue("ВО", null) || t.isValue("ПО", null)) || t.isValue("ОКОЛО", null)) {
                        if (it0 != null && it0.getTyp() == AddressItemType.NUMBER) 
                            break;
                        continue;
                    }
                }
                if (t.getMorph()._getClass().isNoun()) {
                    if ((t.isValue("ДВОР", null) || t.isValue("ПОДЪЕЗД", null) || t.isValue("КРЫША", null)) || t.isValue("ПОДВАЛ", null)) 
                        continue;
                }
                if (t.isValue("ТЕРРИТОРИЯ", "ТЕРИТОРІЯ")) 
                    continue;
                if (t.isChar('(') && t.getNext() != null) {
                    it0 = tryParse(t.getNext(), pre, null, null);
                    if (it0 != null && it0.getEndToken().getNext() != null && it0.getEndToken().getNext().isChar(')')) {
                        it0 = it0.clone();
                        it0.setBeginToken(t);
                        it0.setEndToken(it0.getEndToken().getNext());
                        it = it0;
                        res.add(it);
                        t = it.getEndToken();
                        continue;
                    }
                    java.util.ArrayList<AddressItemToken> li0 = tryParseListInt(t.getNext(), 3);
                    if ((li0 != null && li0.size() > 1 && li0.get(0).getTyp() != AddressItemType.DETAIL) && li0.get(li0.size() - 1).getEndToken().getNext() != null && li0.get(li0.size() - 1).getEndToken().getNext().isChar(')')) {
                        com.pullenti.unisharp.Utils.putArrayValue(li0, 0, li0.get(0).clone());
                        li0.get(0).setBeginToken(t);
                        com.pullenti.unisharp.Utils.putArrayValue(li0, li0.size() - 1, li0.get(li0.size() - 1).clone());
                        li0.get(li0.size() - 1).setEndToken(li0.get(li0.size() - 1).getEndToken().getNext());
                        com.pullenti.unisharp.Utils.addToArrayList(res, li0);
                        it = li0.get(li0.size() - 1);
                        t = it.getEndToken();
                        continue;
                    }
                    com.pullenti.ner.core.BracketSequenceToken br = com.pullenti.ner.core.BracketHelper.tryParse(t, com.pullenti.ner.core.BracketParseAttr.NO, 100);
                    if (br != null && (br.getLengthChar() < 100)) {
                        if (t.getNext().isValue("БЫВШИЙ", null) || t.getNext().isValue("БЫВШ", null)) {
                            it = new AddressItemToken(AddressItemType.DETAIL, t, br.getEndToken());
                            res.add(it);
                        }
                        t = br.getEndToken();
                        continue;
                    }
                }
                boolean checkKv = false;
                if (t.isValue("КВ", null) || t.isValue("KB", null)) {
                    if (it.getTyp() == AddressItemType.NUMBER && res.size() > 1 && res.get(res.size() - 2).getTyp() == AddressItemType.STREET) 
                        checkKv = true;
                    else if ((it.getTyp() == AddressItemType.HOUSE || it.getTyp() == AddressItemType.BUILDING || it.getTyp() == AddressItemType.CORPUS) || it.getTyp() == AddressItemType.CORPUSORFLAT) {
                        for (int jj = res.size() - 2; jj >= 0; jj--) {
                            if (res.get(jj).getTyp() == AddressItemType.STREET || res.get(jj).getTyp() == AddressItemType.CITY) 
                                checkKv = true;
                        }
                    }
                    if (checkKv) {
                        com.pullenti.ner.Token tt2 = t.getNext();
                        if (tt2 != null && tt2.isChar('.')) 
                            tt2 = tt2.getNext();
                        AddressItemToken it22 = tryParsePureItem(tt2, null, null);
                        if (it22 != null && it22.getTyp() == AddressItemType.NUMBER) {
                            it22 = it22.clone();
                            it22.setBeginToken(t);
                            it22.setTyp(AddressItemType.FLAT);
                            res.add(it22);
                            t = it22.getEndToken();
                            continue;
                        }
                    }
                }
                if (res.get(res.size() - 1).getTyp() == AddressItemType.CITY) {
                    if (((t.isHiphen() || t.isChar('_') || t.isValue("НЕТ", null))) && t.getNext() != null && t.getNext().isComma()) {
                        AddressItemToken att = tryParsePureItem(t.getNext().getNext(), null, null);
                        if (att != null) {
                            if (att.getTyp() == AddressItemType.HOUSE || att.getTyp() == AddressItemType.BUILDING || att.getTyp() == AddressItemType.CORPUS) {
                                it = new AddressItemToken(AddressItemType.STREET, t, t);
                                res.add(it);
                                continue;
                            }
                        }
                    }
                }
                if (t.getLengthChar() == 2 && (t instanceof com.pullenti.ner.TextToken) && t.chars.isAllUpper()) {
                    String term = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.TextToken.class)).term;
                    if (!com.pullenti.unisharp.Utils.isNullOrEmpty(term) && term.charAt(0) == 'Р') 
                        continue;
                }
                break;
            }
            if (t.getWhitespacesBeforeCount() > 15) {
                if (it0.getTyp() == AddressItemType.STREET && last.getTyp() == AddressItemType.CITY) {
                }
                else 
                    break;
            }
            if (t.isNewlineBefore() && it0.getTyp() == AddressItemType.STREET && it0.refToken != null) {
                if (!it0.refTokenIsGsk) 
                    break;
            }
            if (it0.getTyp() == AddressItemType.STREET && t.isValue("КВ", null)) {
                if (it != null) {
                    if (it.getTyp() == AddressItemType.HOUSE || it.getTyp() == AddressItemType.BUILDING || it.getTyp() == AddressItemType.CORPUS) {
                        AddressItemToken it2 = tryParsePureItem(t, null, null);
                        if (it2 != null && it2.getTyp() == AddressItemType.FLAT) 
                            it0 = it2;
                    }
                }
            }
            if (it0.getTyp() == AddressItemType.PREFIX) {
                if (it.getTyp() == AddressItemType.CITY) {
                    AddressItemToken it1 = tryParse(it0.getEndToken().getNext(), false, null, null);
                    if (it1 != null && it1.getTyp() == AddressItemType.STREET) 
                        it0 = it1;
                    else 
                        break;
                }
                else 
                    break;
            }
            if (it0.getTyp() == AddressItemType.NUMBER) {
                if (com.pullenti.unisharp.Utils.isNullOrEmpty(it0.value)) 
                    break;
                if (!Character.isDigit(it0.value.charAt(0))) 
                    break;
                if (it0.isNewlineBefore() && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it0) && res.get(res.size() - 1).getTyp() != AddressItemType.STREET) 
                    break;
                if (it0.getBeginToken().isValue("НОМЕР", null)) {
                }
                else {
                    int cou = 0;
                    for (int i = res.size() - 1; i >= 0; i--) {
                        if (res.get(i).getTyp() == AddressItemType.NUMBER) 
                            cou++;
                        else 
                            break;
                    }
                    if (cou > 5) 
                        break;
                    if (it.isDoubt && t.isNewlineBefore()) 
                        break;
                }
            }
            if (it0.getTyp() == AddressItemType.CORPUSORFLAT && it != null && it.getTyp() == AddressItemType.FLAT) 
                it0.setTyp(AddressItemType.ROOM);
            if ((it0.altTyp == null && (((it0.getTyp() == AddressItemType.FLOOR || it0.getTyp() == AddressItemType.POTCH || it0.getTyp() == AddressItemType.BLOCK) || it0.getTyp() == AddressItemType.KILOMETER)) && com.pullenti.unisharp.Utils.isNullOrEmpty(it0.value)) && it.getTyp() == AddressItemType.NUMBER && it.getEndToken().getNext() == it0.getBeginToken()) {
                it = it.clone();
                com.pullenti.unisharp.Utils.putArrayValue(res, res.size() - 1, it);
                it.setTyp(it0.getTyp());
                it.setEndToken(it0.getEndToken());
            }
            else if ((it0.altTyp == null && ((it.getTyp() == AddressItemType.FLOOR || it.getTyp() == AddressItemType.POTCH)) && com.pullenti.unisharp.Utils.isNullOrEmpty(it.value)) && it0.getTyp() == AddressItemType.NUMBER && it.getEndToken().getNext() == it0.getBeginToken()) {
                it = it.clone();
                com.pullenti.unisharp.Utils.putArrayValue(res, res.size() - 1, it);
                it.value = it0.value;
                it.setEndToken(it0.getEndToken());
            }
            else {
                it = it0;
                res.add(it);
                while (it.altTyp != null) {
                    res.add(it.altTyp);
                    it = it.altTyp;
                }
                if (it.next != null) {
                    res.add(it.next);
                    it = it.next;
                }
            }
            t = it.getEndToken();
        }
        if ((res.size() > 1 && res.get(0).getTyp() == AddressItemType.DETAIL && res.get(0).detailType == com.pullenti.ner.address.AddressDetailType.CROSS) && res.get(1).getTyp() != AddressItemType.STREET) 
            return null;
        if (res.size() > 0) {
            it = res.get(res.size() - 1);
            AddressItemToken it0 = (res.size() > 1 ? res.get(res.size() - 2) : null);
            if (it.getTyp() == AddressItemType.NUMBER && it0 != null && it0.refToken != null) {
                for (com.pullenti.ner.Slot s : it0.refToken.referent.getSlots()) {
                    if (com.pullenti.unisharp.Utils.stringsEq(s.getTypeName(), "TYPE")) {
                        String ss = (String)com.pullenti.unisharp.Utils.cast(s.getValue(), String.class);
                        if ((ss.indexOf("гараж") >= 0) || ((ss.charAt(0) == 'Г' && ss.charAt(ss.length() - 1) == 'К'))) {
                            if (it0.refToken.referent.findSlot("NAME", "РОСАТОМ", true) != null) 
                                break;
                            it.setTyp(AddressItemType.BOX);
                            break;
                        }
                    }
                }
            }
            if (it.getTyp() == AddressItemType.NUMBER || it.getTyp() == AddressItemType.ZIP) {
                boolean del = false;
                if (it.getBeginToken().getPrevious() != null && it.getBeginToken().getPrevious().getMorph()._getClass().isPreposition()) {
                    if (res.size() > 1 && res.get(res.size() - 2).getEndToken().getNext() == it.getBeginToken()) {
                    }
                    else 
                        del = true;
                }
                else if (it.getMorph()._getClass().isNoun() && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it)) 
                    del = true;
                if ((!del && it.getEndToken().getWhitespacesAfterCount() == 1 && it.getWhitespacesBeforeCount() > 0) && it.getTyp() == AddressItemType.NUMBER) {
                    com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.geo.internal.MiscLocationHelper.tryParseNpt(it.getEndToken().getNext());
                    if (npt != null) 
                        del = true;
                }
                if (del) 
                    res.remove(res.size() - 1);
                else if ((it.getTyp() == AddressItemType.NUMBER && it0 != null && it0.getTyp() == AddressItemType.STREET) && it0.refToken == null) {
                    if (it.getBeginToken().getPrevious().isChar(',') || it.isNewlineAfter()) {
                        it = it.clone();
                        com.pullenti.unisharp.Utils.putArrayValue(res, res.size() - 1, it);
                        it.setTyp(AddressItemType.HOUSE);
                        it.isDoubt = true;
                    }
                }
            }
        }
        if (res.size() == 0) 
            return null;
        if ((res.size() == 1 && res.get(0).getTyp() == AddressItemType.STREET && res.get(0).chars.isLatinLetter()) && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res.get(0))) 
            return null;
        for (AddressItemToken r : res) {
            if (r.getTyp() == AddressItemType.CITY || r.getTyp() == AddressItemType.STREET) {
                AddressItemToken ty = _findAddrTyp(r.getBeginToken(), r.getEndChar(), 0);
                if (ty != null) {
                    if (r.detailType == com.pullenti.ner.address.AddressDetailType.UNDEFINED) 
                        r.detailType = ty.detailType;
                    if (ty.detailMeters > 0) 
                        r.detailMeters = ty.detailMeters;
                    if (ty.detailParam != null) 
                        r.detailParam = ty.detailParam;
                }
            }
        }
        for (int i = 0; i < (res.size() - 2); i++) {
            if (res.get(i).getTyp() == AddressItemType.STREET && res.get(i + 1).getTyp() == AddressItemType.NUMBER) {
                if ((res.get(i + 2).getTyp() == AddressItemType.BUILDING || res.get(i + 2).getTyp() == AddressItemType.CORPUS || res.get(i + 2).getTyp() == AddressItemType.OFFICE) || res.get(i + 2).getTyp() == AddressItemType.FLAT) {
                    com.pullenti.unisharp.Utils.putArrayValue(res, i + 1, res.get(i + 1).clone());
                    res.get(i + 1).setTyp(AddressItemType.HOUSE);
                }
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if (res.get(i).getTyp() == AddressItemType.STREET && res.get(i + 1).getTyp() == AddressItemType.CITY && (res.get(i).referent instanceof com.pullenti.ner.address.StreetReferent)) {
                com.pullenti.ner.address.StreetReferent sr = (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i).referent, com.pullenti.ner.address.StreetReferent.class);
                if (sr.getSlots().size() != 2 || sr.getKind() != com.pullenti.ner.address.StreetKind.AREA || sr.getTyps().size() != 1) 
                    continue;
                if (i == 0 && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res.get(0))) {
                }
                else if (i > 0 && res.get(i - 1).getTyp() == AddressItemType.CITY) {
                }
                else 
                    continue;
                com.pullenti.ner.Token tt = res.get(i + 1).getBeginToken();
                if (tt instanceof com.pullenti.ner.ReferentToken) 
                    tt = ((com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.ReferentToken.class)).getBeginToken();
                com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.core.NounPhraseHelper.tryParse(tt, com.pullenti.ner.core.NounPhraseParseAttr.NO, 0, null);
                if (npt != null && npt.getEndChar() == res.get(i + 1).getEndChar()) {
                    res.get(i).setEndToken(res.get(i + 1).getEndToken());
                    sr.addSlot(com.pullenti.ner.address.StreetReferent.ATTR_NAME, npt.getNormalCaseText(null, com.pullenti.morph.MorphNumber.UNDEFINED, com.pullenti.morph.MorphGender.UNDEFINED, false), false, 0);
                    res.remove(i + 1);
                    break;
                }
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if (res.get(i).getTyp() == AddressItemType.BUILDING && res.get(i).getBeginToken() == res.get(i).getEndToken() && res.get(i).getBeginToken().getLengthChar() == 1) {
                if (res.get(i + 1).getTyp() == AddressItemType.CITY) {
                    res.remove(i);
                    i--;
                }
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if (res.get(i).getTyp() == AddressItemType.FLAT && res.get(i + 1).getTyp() == AddressItemType.STREET && (res.get(i + 1).refToken instanceof com.pullenti.ner.geo.internal.OrgItemToken)) {
                String str = res.get(i + 1).refToken.toString().toUpperCase();
                if ((str.indexOf("ЛЕСНИЧ") >= 0)) {
                    res.get(i + 1).setBeginToken(res.get(i).getBeginToken());
                    res.get(i + 1).referent.addSlot("NUMBER", res.get(i).value, false, 0);
                    res.remove(i);
                    break;
                }
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if ((res.get(i).getTyp() == res.get(i + 1).getTyp() && (((res.get(i).getTyp() == AddressItemType.ROOM || res.get(i).getTyp() == AddressItemType.FLAT || res.get(i).getTyp() == AddressItemType.SPACE) || res.get(i).getTyp() == AddressItemType.OFFICE)) && res.get(i).value != null) && res.get(i + 1).value != null) {
                com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                if (com.pullenti.unisharp.Utils.stringsNe(res.get(i).value, res.get(i + 1).value)) 
                    res.get(i).value = (res.get(i).value + "," + res.get(i + 1).value);
                res.get(i).setEndToken(res.get(i + 1).getEndToken());
                res.remove(i + 1);
                i--;
            }
            else if ((res.get(i).getTyp() == AddressItemType.SPACE && res.get(i).value != null && res.get(i + 1).getTyp() == AddressItemType.BUILDING) && res.get(i + 1).buildingType == com.pullenti.ner.address.AddressBuildingType.LITER) {
                com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                res.get(i).value = (res.get(i).value + res.get(i + 1).value);
                res.get(i).setEndToken(res.get(i + 1).getEndToken());
                res.remove(i + 1);
                i--;
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if ((res.get(i).getTyp() == AddressItemType.STREET && (res.get(i).referent instanceof com.pullenti.ner.address.StreetReferent) && res.get(i + 1).getTyp() == AddressItemType.STREET) && (res.get(i + 1).refToken instanceof com.pullenti.ner.geo.internal.OrgItemToken)) {
                com.pullenti.ner.address.StreetReferent ss = (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i).referent, com.pullenti.ner.address.StreetReferent.class);
                if (ss.getNumbers() == null || ss.getNames().size() > 0) 
                    continue;
                if (!(ss.toString().indexOf("квартал") >= 0)) 
                    continue;
                String str = res.get(i + 1).refToken.toString().toUpperCase();
                if (!(str.indexOf("ЛЕСНИЧ") >= 0)) 
                    continue;
                res.get(i + 1).setBeginToken(res.get(i).getBeginToken());
                res.get(i + 1).referent.addSlot("NUMBER", ss.getNumbers(), false, 0);
                res.remove(i);
                break;
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if ((res.get(i).getTyp() == AddressItemType.STREET && res.get(i + 1).getTyp() == AddressItemType.KILOMETER && (res.get(i).referent instanceof com.pullenti.ner.address.StreetReferent)) && ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i).referent, com.pullenti.ner.address.StreetReferent.class)).getNumbers() == null) {
                com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i).referent, com.pullenti.ner.address.StreetReferent.class)).setNumbers(res.get(i + 1).value + "км");
                res.get(i).setEndToken(res.get(i + 1).getEndToken());
                res.remove(i + 1);
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if ((res.get(i + 1).getTyp() == AddressItemType.STREET && res.get(i).getTyp() == AddressItemType.KILOMETER && (res.get(i + 1).referent instanceof com.pullenti.ner.address.StreetReferent)) && ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i + 1).referent, com.pullenti.ner.address.StreetReferent.class)).getNumbers() == null) {
                com.pullenti.unisharp.Utils.putArrayValue(res, i + 1, res.get(i + 1).clone());
                ((com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i + 1).referent, com.pullenti.ner.address.StreetReferent.class)).setNumbers(res.get(i).value + "км");
                res.get(i + 1).setBeginToken(res.get(i).getBeginToken());
                res.remove(i);
                break;
            }
        }
        for (int i = 0; i < (res.size() - 1); i++) {
            if (res.get(i).getTyp() == AddressItemType.BUILDING && res.get(i + 1).getTyp() == AddressItemType.BUILDING && (res.get(i).getBeginToken() instanceof com.pullenti.ner.TextToken)) {
                if (((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(res.get(i).getBeginToken(), com.pullenti.ner.TextToken.class)).term.startsWith("ЗД")) {
                    com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                    res.get(i).setTyp(AddressItemType.HOUSE);
                }
            }
        }
        for (int i = 0; i < res.size(); i++) {
            if (res.get(i).getTyp() == AddressItemType.PART) {
                if (i > 0 && ((res.get(i - 1).getTyp() == AddressItemType.HOUSE || res.get(i - 1).getTyp() == AddressItemType.PLOT))) 
                    continue;
                if (((i + 1) < res.size()) && ((res.get(i + 1).getTyp() == AddressItemType.HOUSE || res.get(i + 1).getTyp() == AddressItemType.PLOT))) 
                    continue;
                if (i == 0) 
                    return null;
                for(int jjj = i + res.size() - i - 1, mmm = i; jjj >= mmm; jjj--) res.remove(jjj);
                break;
            }
            else if ((res.get(i).getTyp() == AddressItemType.NONUMBER && i == (res.size() - 1) && i > 0) && res.get(i - 1).getTyp() == AddressItemType.CITY) {
                com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                res.get(i).setTyp(AddressItemType.HOUSE);
            }
        }
        for (int i = 0; i < res.size(); i++) {
            if (res.get(i).areaTerr != null) {
                com.pullenti.ner.geo.GeoReferent ter = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(i).areaTerr.referent, com.pullenti.ner.geo.GeoReferent.class);
                if ((ter.isRegion() && i > 0 && res.get(i - 1).getTyp() == AddressItemType.CITY) && ter.getHigher() == null) 
                    ter.setHigher((com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(i - 1).referent, com.pullenti.ner.geo.GeoReferent.class));
                res.add(i, res.get(i).areaTerr);
                i++;
            }
        }
        if (res.size() > 0 && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res.get(0))) {
            for (int i = 0; i < (res.size() - 1); i++) {
                for (int j = i + 1; j < res.size(); j++) {
                    if (res.get(j).isNewlineBefore()) 
                        break;
                    if (res.get(i).getTyp() == res.get(j).getTyp() && (res.get(i).referent instanceof com.pullenti.ner.geo.GeoReferent) && res.get(j).referent == res.get(i).referent) {
                        res.remove(j);
                        j--;
                    }
                }
            }
        }
        for (int i = 1; i < res.size(); i++) {
            if (res.get(i).getTyp() == AddressItemType.POTCH && res.get(i).value != null) {
                boolean ok = false;
                if (res.get(i - 1).getTyp() == AddressItemType.STREET) 
                    ok = true;
                else if (((i + 1) < res.size()) && res.get(i + 1).getTyp() == AddressItemType.STREET) 
                    ok = true;
                if (!ok) 
                    continue;
                it = res.get(i);
                AddressItemToken rr = new AddressItemToken(AddressItemType.STREET, it.getBeginToken(), it.getEndToken());
                com.pullenti.ner.address.StreetReferent sr = new com.pullenti.ner.address.StreetReferent();
                sr.addTyp("подъезд");
                sr.addSlot(com.pullenti.ner.address.StreetReferent.ATTR_NUMBER, it.value, false, 0);
                rr.referent = sr;
                com.pullenti.unisharp.Utils.putArrayValue(res, i, rr);
            }
        }
        for (int i = res.size() - 1; i > 0; i--) {
            if (res.get(i).getTyp() == AddressItemType.NUMBER && res.get(i).value != null && res.get(i).getBeginToken().isValue("НОМЕР", null)) {
                if (res.get(i - 1).getTyp() == AddressItemType.SPACE || res.get(i - 1).getTyp() == AddressItemType.FLAT) 
                    res.get(i).setTyp(AddressItemType.ROOM);
                else if ((res.get(i - 1).getTyp() == AddressItemType.FLOOR || res.get(i - 1).getTyp() == AddressItemType.HOUSE || res.get(i - 1).getTyp() == AddressItemType.CORPUS) || res.get(i - 1).getTyp() == AddressItemType.BUILDING) 
                    res.get(i).setTyp(AddressItemType.FLAT);
            }
        }
        while (res.size() > 0) {
            AddressItemToken last = res.get(res.size() - 1);
            if (last.detailType == com.pullenti.ner.address.AddressDetailType.ORG && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(it)) {
                res.remove(res.size() - 1);
                continue;
            }
            if (last.getTyp() == AddressItemType.DETAIL && last.detailType == com.pullenti.ner.address.AddressDetailType.CROSS && last.getLengthChar() == 1) {
                res.remove(res.size() - 1);
                continue;
            }
            if (last.getTyp() == AddressItemType.CITY && res.size() > 4) {
                boolean ok = false;
                for (int ii = 0; ii < 3; ii++) {
                    if (res.get(ii).getTyp() == AddressItemType.CITY) {
                        com.pullenti.ner.geo.GeoReferent geo1 = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(last.referent, com.pullenti.ner.geo.GeoReferent.class);
                        com.pullenti.ner.geo.GeoReferent geo0 = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(ii).referent, com.pullenti.ner.geo.GeoReferent.class);
                        if ((geo1 != null && geo0 != null && geo0.getHigher() == null) && com.pullenti.ner.geo.internal.GeoOwnerHelper.canBeHigher(geo1, geo0, null, null)) 
                            break;
                        ok = true;
                    }
                }
                if (ok) {
                    res.remove(res.size() - 1);
                    continue;
                }
            }
            if (last.getTyp() != AddressItemType.STREET || !(last.refToken instanceof com.pullenti.ner.geo.internal.OrgItemToken)) 
                break;
            if (((com.pullenti.ner.geo.internal.OrgItemToken)com.pullenti.unisharp.Utils.cast(last.refToken, com.pullenti.ner.geo.internal.OrgItemToken.class)).isGsk || ((com.pullenti.ner.geo.internal.OrgItemToken)com.pullenti.unisharp.Utils.cast(last.refToken, com.pullenti.ner.geo.internal.OrgItemToken.class)).hasTerrKeyword) 
                break;
            if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(last)) 
                break;
            res.remove(res.size() - 1);
        }
        if (res.size() > 2 && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res.get(0))) {
            for (int i = 1; i < res.size(); i++) {
                if (((res.get(i - 1).getTyp() == AddressItemType.STREET || res.get(i - 1).getTyp() == AddressItemType.CITY)) && res.get(i).getTyp() == AddressItemType.STREET) {
                    com.pullenti.ner.address.StreetReferent sr = (com.pullenti.ner.address.StreetReferent)com.pullenti.unisharp.Utils.cast(res.get(i).referent, com.pullenti.ner.address.StreetReferent.class);
                    if (sr == null) 
                        continue;
                    if ((sr.getNumbers() == null || sr.getNames().size() > 0 || sr.getTyps().size() != 1) || com.pullenti.unisharp.Utils.stringsNe(sr.getTyps().get(0), "улица")) 
                        continue;
                    if ((i + 1) < res.size()) 
                        continue;
                    if (res.get(i - 1).getTyp() == AddressItemType.CITY) {
                        com.pullenti.ner.geo.GeoReferent geo = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(res.get(i - 1).referent, com.pullenti.ner.geo.GeoReferent.class);
                        if (geo == null) 
                            continue;
                        if (geo.getTyps().contains("город")) 
                            continue;
                    }
                    com.pullenti.unisharp.Utils.putArrayValue(res, i, res.get(i).clone());
                    res.get(i).setTyp(AddressItemType.HOUSE);
                    res.get(i).value = sr.getNumbers();
                    res.get(i).referent = null;
                }
            }
        }
        for (int i = 0; i < (res.size() - 2); i++) {
            if (res.get(i).getTyp() == AddressItemType.REGION && res.get(i + 1).getTyp() == AddressItemType.NUMBER && res.get(i + 2).getTyp() == AddressItemType.CITY) {
                boolean ok = false;
                for (int j = i + 3; j < res.size(); j++) {
                    if (res.get(j).getTyp() == AddressItemType.STREET || res.get(j).value != null) 
                        ok = true;
                }
                if (ok) {
                    res.remove(i + 1);
                    break;
                }
            }
        }
        return res;
    }

    public static void initialize() {
        if (m_Ontology != null) 
            return;
        StreetItemToken.initialize();
        m_Ontology = new com.pullenti.ner.core.TerminCollection();
        com.pullenti.ner.core.Termin t;
        t = com.pullenti.ner.core.Termin._new96("ДОМ", AddressItemType.HOUSE);
        t.addAbridge("Д.");
        t.addVariant("КОТТЕДЖ", false);
        t.addAbridge("КОТ.");
        t.addVariant("ДАЧА", false);
        t.addVariant("ЖИЛОЙ ДОМ", false);
        t.addAbridge("ЖИЛ.ДОМ");
        t.addVariant("ДО ДОМА", false);
        t.addVariant("ДОМ ОФИЦЕРСКОГО СОСТАВА", false);
        t.addVariant("ДОС", false);
        t.addVariant("ЗДАНИЕ", false);
        t.addAbridge("ЗД.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new97("БУДИНОК", AddressItemType.HOUSE, com.pullenti.morph.MorphLang.UA);
        t.addAbridge("Б.");
        t.addVariant("КОТЕДЖ", false);
        t.addAbridge("БУД.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ВЛАДЕНИЕ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.ESTATE);
        t.addAbridge("ВЛАД.");
        t.addAbridge("ВЛД.");
        t.addAbridge("ВЛ.");
        m_Ontology.add(t);
        M_OWNER = t;
        t = com.pullenti.ner.core.Termin._new98("ДОМОВЛАДЕНИЕ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.HOUSEESTATE);
        t.addVariant("ДОМОВЛАДЕНИЕ", false);
        t.addAbridge("ДВЛД.");
        t.addAbridge("ДМВЛД.");
        t.addVariant("ДОМОВЛ", false);
        t.addVariant("ДОМОВА", false);
        t.addVariant("ДОМОВЛАД", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new100("ОБЪЕКТ НЕЗАВЕРШЕННОГО СТРОИТЕЛЬСТВА", "ОНС", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.UNFINISHED);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ПОДЪЕЗД ДОМА", AddressItemType.HOUSE);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ЭТАЖ", AddressItemType.FLOOR);
        t.addAbridge("ЭТ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new103("ЦОКОЛЬ", AddressItemType.FLOOR, "цокольный");
        t.addVariant("ЦОКОЛ", false);
        t.addVariant("ЦОКОЛЬНЫЙ", false);
        t.addVariant("ЦОКОЛЬНЫЙ ЭТАЖ", false);
        t.addVariant("ЭТАЖ ЦОКОЛЬНЫЙ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new103("МАНСАРДА", AddressItemType.FLOOR, "мансарда");
        t.addVariant("МАНСАРДНЫЙ", false);
        t.addVariant("МАНСАРДА ЭТАЖ", false);
        t.addVariant("ЭТАЖ МАНСАРДА", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ПОДЪЕЗД", AddressItemType.POTCH);
        t.addAbridge("ПОД.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("КОРПУС", AddressItemType.CORPUS);
        t.addAbridge("КОРП.");
        t.addAbridge("КОР.");
        t.addAbridge("Д.КОРП.");
        t.addAbridge("БЛ/СЕК");
        t.addAbridge("БЛ/ЖД");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("К", AddressItemType.CORPUSORFLAT);
        t.addAbridge("К.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("СТРОЕНИЕ", AddressItemType.BUILDING);
        t.addAbridge("СТРОЕН.");
        t.addAbridge("СТР.");
        t.addAbridge("СТ.");
        t.addAbridge("ПОМ.СТР.");
        t.addAbridge("Д.СТР.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new100("СООРУЖЕНИЕ", "РК", AddressItemType.BUILDING, com.pullenti.ner.address.AddressBuildingType.CONSTRUCTION);
        t.addAbridge("СООР.");
        t.addAbridge("СООРУЖ.");
        t.addAbridge("СООРУЖЕН.");
        t.addVariant("БАШНЯ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЛИТЕРА", AddressItemType.BUILDING, com.pullenti.ner.address.AddressBuildingType.LITER);
        t.addAbridge("ЛИТ.");
        t.addVariant("ЛИТЕР", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("УЧАСТОК", AddressItemType.PLOT);
        t.addAbridge("УЧАСТ.");
        t.addAbridge("УЧ.");
        t.addAbridge("УЧ-К");
        t.addAbridge("ДОМ УЧ.");
        t.addAbridge("ДОМ.УЧ.");
        t.addAbridge("У-К");
        t.addVariant("ЗЕМЕЛЬНЫЙ УЧАСТОК", false);
        t.addAbridge("ЗЕМ.УЧ.");
        t.addAbridge("ЗЕМ.УЧ-К");
        t.addAbridge("З/У");
        t.addVariant("ЧАСТЬ ВЫДЕЛА", false);
        t.addVariant("ВЫДЕЛ", false);
        t.addVariant("НАДЕЛ", false);
        t.addVariant("КОНТУР", false);
        t.addAbridge("ЗУ");
        t.addAbridge("ВЫД.");
        t.addVariant("МЕСТО", false);
        t.addVariant("ПОЗИЦИЯ", false);
        t.addAbridge("ПОЗ.");
        m_Ontology.add(t);
        M_PLOT = t;
        t = com.pullenti.ner.core.Termin._new96("ПОЛЕ", AddressItemType.FIELD);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new113("ГЕНЕРАЛЬНЫЙ ПЛАН", "ГП", AddressItemType.GENPLAN);
        t.addVariant("ГЕНПЛАН", false);
        t.addAbridge("ГЕН.ПЛАН");
        t.addAbridge("Г/П");
        t.addAbridge("Г.П.");
        t.addVariant("ПО ГП", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("КВАРТИРА", AddressItemType.FLAT);
        t.addAbridge("КВАРТ.");
        t.addAbridge("КВАР.");
        t.addAbridge("КВ.");
        t.addAbridge("KB.");
        t.addAbridge("КВ-РА");
        t.addAbridge("КВ.КОМ");
        t.addAbridge("КВ.ОБЩ");
        t.addAbridge("КВ.Ч.");
        t.addAbridge("КВЮ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ОФИС", AddressItemType.OFFICE);
        t.addAbridge("ОФ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new97("ОФІС", AddressItemType.OFFICE, com.pullenti.morph.MorphLang.UA);
        t.addAbridge("ОФ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ПАВИЛЬОН", AddressItemType.PAVILION);
        t.addAbridge("ПАВ.");
        t.addVariant("ТОРГОВЫЙ ПАВИЛЬОН", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new97("ПАВІЛЬЙОН", AddressItemType.PAVILION, com.pullenti.morph.MorphLang.UA);
        t.addAbridge("ПАВ.");
        t.addVariant("ТОРГОВИЙ ПАВІЛЬЙОН", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("СЕКЦИЯ", AddressItemType.BLOCK);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("БОКС", AddressItemType.BOX);
        t.addVariant("ГАРАЖ", false);
        t.addAbridge("ГАР.");
        t.addVariant("ГАРАЖНАЯ ЯЧЕЙКА", false);
        t.addAbridge("Г-Ж");
        t.addVariant("ПОДЪЕЗД", false);
        t.addAbridge("ГАРАЖ-БОКС");
        t.addVariant("ИНДИВИДУАЛЬНЫЙ ГАРАЖ", false);
        t.addVariant("ГАРАЖНЫЙ БОКС", false);
        t.addAbridge("ГБ.");
        t.addAbridge("Г.Б.");
        t.addVariant("ЭЛЛИНГ", false);
        t.addVariant("ЭЛИНГ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ЧАСТЬ", AddressItemType.PART);
        t.addAbridge("Ч.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("СКВАЖИНА", AddressItemType.WELL);
        t.addAbridge("СКВАЖ.");
        t.addVariant("СКВАЖИНА ГАЗОКОНДЕНСАТНАЯ ЭКСПЛУАТАЦИОННАЯ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ПОМЕЩЕНИЕ", AddressItemType.SPACE);
        t.addVariant("ПОМЕЩЕНИЕ", false);
        t.addAbridge("ПОМ.");
        t.addAbridge("ПОМЕЩ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new124("НЕЖИЛОЕ ПОМЕЩЕНИЕ", "НЕЖИЛОЕ", AddressItemType.SPACE, 1);
        t.addAbridge("Н.П.");
        t.addVariant("НП", false);
        t.addVariant("НЖ", false);
        t.addVariant("НЕЖИЛОЕ", false);
        t.addAbridge("НЕЖИЛ.");
        t.addVariant("НЕЖИЛОЕ ВСТРОЕННОЕ ПОМЕЩЕНИЕ", false);
        t.addAbridge("НЕЖ.ПОМ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new125("МЕСТО ОБЩЕГО ПОЛЬЗОВАНИЯ", "МОП", true, "МОП", AddressItemType.SPACE, 1);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("КЛАДОВКА", AddressItemType.SPACE, 1);
        t.addAbridge("КЛАД.");
        t.addAbridge("КЛ.");
        t.addVariant("КЛАДОВАЯ", false);
        t.addVariant("КЛАДОВОЕ ПОМЕЩЕНИЕ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("СКЛАД", AddressItemType.SPACE, 1);
        t.addAbridge("СКЛ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("КОТЕЛЬНАЯ", AddressItemType.SPACE, 1);
        t.addAbridge("КОТ.");
        t.addAbridge("КОТЕЛ.");
        t.addAbridge("КОТЕЛН.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ТОРГОВЫЙ ЗАЛ", AddressItemType.SPACE, 1);
        t.addAbridge("ТОРГ.ЗАЛ");
        t.addAbridge("ТОРГОВ.ЗАЛ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new124("ЦЕХ", "цех", AddressItemType.SPACE, 1);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("РАБОЧИЙ УЧАСТОК", AddressItemType.SPACE, 1);
        t.addAbridge("РАБ.УЧ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new132("ЛЕСТНИЧНАЯ КЛЕТКА", "ЛК", "ЛК", AddressItemType.SPACE, 1);
        t.addVariant("ЛФЛК", false);
        t.addVariant("ЛКЛК", false);
        t.addVariant("МОПЛК", false);
        t.addVariant("МОП ЛК", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ПОДВАЛ", AddressItemType.SPACE, 1);
        t.addVariant("ПОДВАЛЬНОЕ ПОМЕЩЕНИЕ", false);
        t.addAbridge("ПОДВ.ПОМ.");
        t.addAbridge("ПОДВАЛ.ПОМ.");
        t.addAbridge("ПОДВ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("АНТРЕСОЛЬ", AddressItemType.SPACE, 1);
        t.addVariant("АНТРЕСОЛ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("МАСТЕРСКАЯ", AddressItemType.SPACE, 1);
        t.addAbridge("МАСТ.");
        m_Ontology.add(t);
        for (String s : new String[] {"ЧЕРДАК", "КРЫША", "ПОГРЕБ"}) {
            m_Ontology.add(com.pullenti.ner.core.Termin._new98(s, AddressItemType.SPACE, 1));
        }
        for (String s : new String[] {"АПТЕКА", "АТЕЛЬЕ", "ОТЕЛЬ", "ГОСТИНИЦА", "ХОСТЕЛ", "СТУДИЯ", "САРАЙ", "ПАРИКМАХЕРСКАЯ", "СТОЛОВАЯ", "КАФЕ", "РЕСТОРАН", "УНИВЕРМАГ", "УНИВЕРСАМ", "СУПЕРМАРКЕТ"}) {
            m_Ontology.add(com.pullenti.ner.core.Termin._new98(s, AddressItemType.SPACE, 1));
        }
        t = com.pullenti.ner.core.Termin._new138("МАГАЗИН", AddressItemType.SPACE, 1, 1);
        t.addAbridge("МАГ.");
        t.addAbridge("МАГ-Н");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new138("АПТЕЧНЫЙ ПУНКТ", AddressItemType.SPACE, 1, 1);
        t.addAbridge("А.П.");
        t.addAbridge("А/П");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("МАШИНОМЕСТО", AddressItemType.CARPLACE);
        t.addAbridge("М/М");
        t.addAbridge("МАШ.МЕСТО");
        t.addAbridge("М.МЕСТО");
        t.addAbridge("МАШ.М.");
        t.addVariant("МАШИНО-МЕСТО", false);
        t.addVariant("ПАРКОВОЧНОЕ МЕСТО", false);
        t.addAbridge("ММ");
        t.addAbridge("MM");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("КОМНАТА", AddressItemType.ROOM);
        t.addAbridge("КОМ.");
        t.addAbridge("КОМН.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("КАБИНЕТ", AddressItemType.OFFICE);
        t.addAbridge("КАБ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("НОМЕР", AddressItemType.NUMBER);
        t.addAbridge("НОМ.");
        t.addAbridge("№");
        t.addAbridge("N");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new144("БЕЗ НОМЕРА", "Б/Н", AddressItemType.NONUMBER);
        t.addVariant("НЕ ОПРЕДЕЛЕНО", false);
        t.addVariant("НЕОПРЕДЕЛЕНО", false);
        t.addVariant("НЕ ЗАДАН", false);
        t.addAbridge("Б.Н.");
        t.addAbridge("БН");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new145("АБОНЕНТСКИЙ ЯЩИК", AddressItemType.POSTOFFICEBOX, "АЯ");
        t.addAbridge("А.Я.");
        t.addVariant("ПОЧТОВЫЙ ЯЩИК", false);
        t.addAbridge("П.Я.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new145("ГОРОДСКАЯ СЛУЖЕБНАЯ ПОЧТА", AddressItemType.CSP, "ГСП");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ДОСТАВОЧНЫЙ УЧАСТОК", AddressItemType.DELIVERYAREA);
        t.addAbridge("ДОСТ.УЧАСТОК");
        t.addAbridge("ДОСТ.УЧ.");
        t.addAbridge("ДОСТ.УЧ-К");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new148("АДРЕС", AddressItemType.PREFIX, true);
        t.addVariant("ЮРИДИЧЕСКИЙ АДРЕС", false);
        t.addVariant("ФАКТИЧЕСКИЙ АДРЕС", false);
        t.addAbridge("ЮР.АДРЕС");
        t.addAbridge("ПОЧТ.АДРЕС");
        t.addAbridge("ФАКТ.АДРЕС");
        t.addAbridge("П.АДРЕС");
        t.addVariant("ЮРИДИЧЕСКИЙ/ФАКТИЧЕСКИЙ АДРЕС", false);
        t.addVariant("ЮРИДИЧЕСКИЙ И ФАКТИЧЕСКИЙ АДРЕС", false);
        t.addVariant("ПОЧТОВЫЙ АДРЕС", false);
        t.addVariant("АДРЕС ПРОЖИВАНИЯ", false);
        t.addVariant("МЕСТО НАХОЖДЕНИЯ", false);
        t.addVariant("МЕСТОНАХОЖДЕНИЕ", false);
        t.addVariant("МЕСТОПОЛОЖЕНИЕ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new148("АДРЕСА", AddressItemType.PREFIX, true);
        t.addVariant("ЮРИДИЧНА АДРЕСА", false);
        t.addVariant("ФАКТИЧНА АДРЕСА", false);
        t.addVariant("ПОШТОВА АДРЕСА", false);
        t.addVariant("АДРЕСА ПРОЖИВАННЯ", false);
        t.addVariant("МІСЦЕ ПЕРЕБУВАННЯ", false);
        t.addVariant("ПРОПИСКА", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("КИЛОМЕТР", AddressItemType.KILOMETER);
        t.addAbridge("КИЛОМ.");
        t.addAbridge("КМ.");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("ПЕРЕСЕЧЕНИЕ", com.pullenti.ner.address.AddressDetailType.CROSS);
        t.addVariant("НА ПЕРЕСЕЧЕНИИ", false);
        t.addVariant("ПЕРЕКРЕСТОК", false);
        t.addVariant("УГОЛ", false);
        t.addVariant("НА ПЕРЕКРЕСТКЕ", false);
        m_Ontology.add(t);
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("НА ТЕРРИТОРИИ", com.pullenti.ner.address.AddressDetailType.NEAR));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕРЕДИНА", com.pullenti.ner.address.AddressDetailType.NEAR));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ПРИМЫКАТЬ", com.pullenti.ner.address.AddressDetailType.NEAR));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ГРАНИЧИТЬ", com.pullenti.ner.address.AddressDetailType.NEAR));
        t = com.pullenti.ner.core.Termin._new96("ВБЛИЗИ", com.pullenti.ner.address.AddressDetailType.NEAR);
        t.addVariant("У", false);
        t.addAbridge("ВБЛ.");
        t.addVariant("В БЛИЗИ", false);
        t.addVariant("ВОЗЛЕ", false);
        t.addVariant("ОКОЛО", false);
        t.addVariant("НЕДАЛЕКО ОТ", false);
        t.addVariant("РЯДОМ С", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new96("РАЙОН", com.pullenti.ner.address.AddressDetailType.NEAR);
        t.addAbridge("Р-Н");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new144("В РАЙОНЕ", "РАЙОН", com.pullenti.ner.address.AddressDetailType.NEAR);
        t.addAbridge("В Р-НЕ");
        m_Ontology.add(t);
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ПРИМЕРНО", com.pullenti.ner.address.AddressDetailType.UNDEFINED));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ПОРЯДКА", com.pullenti.ner.address.AddressDetailType.UNDEFINED));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ПРИБЛИЗИТЕЛЬНО", com.pullenti.ner.address.AddressDetailType.UNDEFINED));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ОРИЕНТИР", com.pullenti.ner.address.AddressDetailType.UNDEFINED));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("НАПРАВЛЕНИЕ", com.pullenti.ner.address.AddressDetailType.UNDEFINED));
        com.pullenti.ner.core.Termin.ASSIGNALLTEXTSASNORMAL = true;
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕРНЕЕ", com.pullenti.ner.address.AddressDetailType.NORTH));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕР", com.pullenti.ner.address.AddressDetailType.NORTH));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮЖНЕЕ", com.pullenti.ner.address.AddressDetailType.SOUTH));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮГ", com.pullenti.ner.address.AddressDetailType.SOUTH));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЗАПАДНЕЕ", com.pullenti.ner.address.AddressDetailType.WEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЗАПАД", com.pullenti.ner.address.AddressDetailType.WEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ВОСТОЧНЕЕ", com.pullenti.ner.address.AddressDetailType.EAST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ВОСТОК", com.pullenti.ner.address.AddressDetailType.EAST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕРО-ЗАПАДНЕЕ", com.pullenti.ner.address.AddressDetailType.NORTHWEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕРО-ЗАПАД", com.pullenti.ner.address.AddressDetailType.NORTHWEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕРО-ВОСТОЧНЕЕ", com.pullenti.ner.address.AddressDetailType.NORTHEAST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("СЕВЕРО-ВОСТОК", com.pullenti.ner.address.AddressDetailType.NORTHEAST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮГО-ЗАПАДНЕЕ", com.pullenti.ner.address.AddressDetailType.SOUTHWEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮГО-ЗАПАД", com.pullenti.ner.address.AddressDetailType.SOUTHWEST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮГО-ВОСТОЧНЕЕ", com.pullenti.ner.address.AddressDetailType.SOUTHEAST));
        m_Ontology.add(com.pullenti.ner.core.Termin._new96("ЮГО-ВОСТОК", com.pullenti.ner.address.AddressDetailType.SOUTHEAST));
        t = com.pullenti.ner.core.Termin._new98("ЦЕНТРАЛЬНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.CENTRAL, 1);
        t.addAbridge("ЦЕНТР.ЧАСТЬ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("СЕВЕРНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.NORTH, 1);
        t.addAbridge("СЕВ.ЧАСТЬ");
        t.addAbridge("СЕВЕРН.ЧАСТЬ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("СЕВЕРО-ВОСТОЧНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.NORTHEAST, 1);
        t.addVariant("СЕВЕРОВОСТОЧНАЯ ЧАСТЬ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("СЕВЕРО-ЗАПАДНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.NORTHWEST, 1);
        t.addVariant("СЕВЕРОЗАПАДНАЯ ЧАСТЬ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЮЖНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.SOUTH, 1);
        t.addAbridge("ЮЖН.ЧАСТЬ");
        t.addAbridge("ЮЖ.ЧАСТЬ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЮГО-ВОСТОЧНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.SOUTHEAST, 1);
        t.addVariant("ЮГОВОСТОЧНАЯ ЧАСТЬ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЮГО-ЗАПАДНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.SOUTHWEST, 1);
        t.addVariant("ЮГОЗАПАДНАЯ ЧАСТЬ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЗАПАДНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.WEST, 1);
        t.addAbridge("ЗАП.ЧАСТЬ");
        t.addAbridge("ЗАПАД.ЧАСТЬ");
        t.addAbridge("ЗАПАДН.ЧАСТЬ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ВОСТОЧНАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.EAST, 1);
        t.addAbridge("ВОСТ.ЧАСТЬ");
        t.addAbridge("ВОСТОЧ.ЧАСТЬ");
        t.addAbridge("ВОСТОЧН.ЧАСТЬ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ПРАВАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.RIGHT, 1);
        t.addAbridge("СПРАВА");
        t.addAbridge("ПРАВ.ЧАСТЬ");
        t.addVariant("ПРАВАЯ СТОРОНА", false);
        t.addAbridge("ПРАВ.СТОРОНА");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new98("ЛЕВАЯ ЧАСТЬ", com.pullenti.ner.address.AddressDetailType.LEFT, 1);
        t.addAbridge("СЛЕВА");
        t.addAbridge("ЛЕВ.ЧАСТЬ");
        t.addVariant("ЛЕВАЯ СТОРОНА", false);
        t.addAbridge("ЛЕВ.СТОРОНА");
        m_Ontology.add(t);
        t = new com.pullenti.ner.core.Termin("ТАМ ЖЕ", null, false);
        t.addAbridge("ТАМЖЕ");
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("АВТОЗАПРАВОЧНАЯ СТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "АЗС", true, true);
        t.addVariant("АВТО ЗАПРАВОЧНАЯ СТАНЦИЯ", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("АВТОНОМНАЯ ТЕПЛОВАЯ СТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "АТС", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ДОРОЖНО РЕМОНТНЫЙ ПУНКТ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ДРП", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("УСТАНОВКА КОМПЛЕКСНОЙ ПОДГОТОВКИ ГАЗА", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "УКПГ", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("УСТАНОВКА ПРЕДВАРИТЕЛЬНОЙ ПОДГОТОВКИ ГАЗА", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "УППГ", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ЦЕНТРАЛЬНЫЙ ПУНКТ СБОРА НЕФТИ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ЦПС", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("КОМПЛЕКТНАЯ ТРАНСФОРМАТОРНАЯ ПОДСТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "КТП", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ТРАНСФОРМАТОРНАЯ ПОДСТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ТП", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ДИСПЕТЧЕРСКАЯ НЕФТЕПРОВОДНАЯ СЛУЖБА", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ДНС", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("КУСТОВАЯ НАСОСНАЯ СТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "КНС", true, true);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ЦЕНТРАЛЬНЫЙ РАСПРЕДЕЛИТЕЛЬНЫЙ ПУНКТ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ЦРП", true, true);
        t.addVariant("ЦРП ТП", false);
        m_Ontology.add(t);
        t = com.pullenti.ner.core.Termin._new191("ТРАНСФОРМАТОРНАЯ ПОДСТАНЦИЯ", AddressItemType.HOUSE, com.pullenti.ner.address.AddressHouseType.SPECIAL, "ТП", true, true);
        m_Ontology.add(t);
        com.pullenti.ner.core.Termin.ASSIGNALLTEXTSASNORMAL = false;
    }

    private static com.pullenti.ner.core.TerminCollection m_Ontology;

    public static com.pullenti.ner.core.Termin M_PLOT;

    public static com.pullenti.ner.core.Termin M_OWNER;

    public static com.pullenti.ner.Token gotoEndOfAddress(com.pullenti.ner.Token t, com.pullenti.unisharp.Outargwrapper<Boolean> _isHouse) {
        _isHouse.value = false;
        com.pullenti.ner.Token brStart = null;
        com.pullenti.ner.Token brEnd = null;
        com.pullenti.ner.Token t1 = t;
        for (com.pullenti.ner.Token tt = t.getNext(); tt != null; tt = tt.getNext()) {
            if ((tt instanceof com.pullenti.ner.NumberToken) || tt.isNewlineBefore()) 
                break;
            com.pullenti.ner.TextToken ttt = (com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class);
            if (ttt == null) 
                break;
            if (ttt.isChar('(')) 
                brStart = tt;
            if (ttt.isChar(')')) 
                brEnd = tt;
            if (!ttt.chars.isLetter()) 
                continue;
            if ((ttt.isValue("ЧАСНЫЙ", null) || ttt.isValue("ЧАСТНЫЙ", null) || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "Ч")) || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ЧАСТН")) {
                com.pullenti.ner.Token tt2 = ttt.getNext();
                if (tt2 != null && tt2.isCharOf(".\\/-")) 
                    tt2 = tt2.getNext();
                if (tt2 instanceof com.pullenti.ner.TextToken) {
                    if ((tt2.isValue("С", null) || tt2.isValue("ДОМ", null) || tt2.isValue("СЕКТ", null)) || tt2.isValue("СЕКТОР", null) || tt2.isValue("Д", null)) {
                        if (tt2.isValue("ДОМ", null)) 
                            _isHouse.value = true;
                        t1 = (tt = tt2);
                        continue;
                    }
                }
            }
            if ((com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ЛПХ") || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ИЖС") || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ЖД")) || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ПС") || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "ВЧ")) {
                t1 = tt;
                continue;
            }
            if (ttt.term.startsWith("ОБЩ") || com.pullenti.unisharp.Utils.stringsEq(ttt.term, "МОП")) {
                _isHouse.value = true;
                t1 = tt;
                continue;
            }
            if (ttt.term.startsWith("СЕМ") || ttt.term.startsWith("ВЕД")) 
                continue;
            if ((ttt.getLengthChar() == 3 && ttt.chars.isAllUpper() && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(ttt)) && com.pullenti.ner.core.NumberHelper.tryParseRoman(ttt) == null) {
                t1 = tt;
                continue;
            }
            if ((ttt.getLengthChar() == 1 && ttt.getNext() != null && ttt.getNext().isCharOf("\\/")) && (ttt.getNext().getNext() instanceof com.pullenti.ner.TextToken) && ttt.getNext().getNext().getLengthChar() == 1) {
                tt = tt.getNext().getNext();
                t1 = tt;
                continue;
            }
            break;
        }
        if (brStart != null && t1.getEndChar() > brStart.getBeginChar()) {
            if (brEnd != null && brEnd.getEndChar() > t1.getEndChar()) 
                t1 = brEnd;
            else {
                com.pullenti.ner.core.BracketSequenceToken br = com.pullenti.ner.core.BracketHelper.tryParse(brStart, com.pullenti.ner.core.BracketParseAttr.NO, 100);
                if (br != null && br.getEndChar() > t1.getEndChar()) 
                    t1 = br.getEndToken();
            }
        }
        return t1;
    }

    public static AddressItemToken tryParsePureItem(com.pullenti.ner.Token t, AddressItemToken prev, com.pullenti.ner.geo.internal.GeoAnalyzerData ad) {
        if (t == null) 
            return null;
        if (t.isChar(',')) 
            return null;
        if (ad == null) 
            ad = com.pullenti.ner.geo.GeoAnalyzer.getData(t);
        if (ad == null) 
            return null;
        int maxLevel = 0;
        if ((prev != null && (t instanceof com.pullenti.ner.NumberToken) && t.getLengthChar() == 5) && ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class)).typ == com.pullenti.ner.NumberSpellingType.DIGIT && !t.getMorph()._getClass().isAdjective()) {
            if (prev.getTyp() == AddressItemType.COUNTRY || prev.getTyp() == AddressItemType.REGION || prev.getTyp() == AddressItemType.CITY) 
                return _new84(AddressItemType.ZIP, t, t, ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class)).getValue().toString());
        }
        if ((prev != null && ((prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.CORPUS || prev.getTyp() == AddressItemType.BUILDING)) && t.isValue("БЛОК", null)) && (t.getWhitespacesAfterCount() < 3)) {
            com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(t.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.STRONG);
            if (nn != null) 
                return _new84(AddressItemType.BLOCK, t, nn.getEndToken(), nn.value);
        }
        if ((prev != null && prev.getTyp() == AddressItemType.STREET && t.getLengthChar() == 1) && ((t.isValue("С", null) || t.isValue("Д", null)))) 
            maxLevel = 1;
        else if (SPEEDREGIME && ((ad.aRegime || ad.allRegime)) && !(t instanceof com.pullenti.ner.ReferentToken)) {
            com.pullenti.ner.geo.internal.GeoTokenData d = (com.pullenti.ner.geo.internal.GeoTokenData)com.pullenti.unisharp.Utils.cast(t.tag, com.pullenti.ner.geo.internal.GeoTokenData.class);
            if (d == null) 
                return null;
            if (d.addr == null) 
                return null;
            if (d.addr.houseType == com.pullenti.ner.address.AddressHouseType.ESTATE && d.noGeo) 
                return null;
            boolean ok = true;
            for (com.pullenti.ner.Token tt = t; tt != null && tt.getBeginChar() <= d.addr.getEndChar(); tt = tt.getNext()) {
                if (tt instanceof com.pullenti.ner.ReferentToken) {
                    ok = false;
                    maxLevel = 1;
                    break;
                }
            }
            if (ok) 
                return d.addr;
        }
        if (ad.aLevel > (maxLevel + 1)) 
            return null;
        if (ad.level > 1) 
            return null;
        ad.level++;
        AddressItemToken res = _tryParsePureItem(t, false, prev);
        if (res == null && com.pullenti.ner.core.BracketHelper.isBracket(t, false) && (t.getWhitespacesAfterCount() < 2)) {
            AddressItemToken res1 = _tryParsePureItem(t.getNext(), false, prev);
            if (res1 != null && com.pullenti.ner.core.BracketHelper.isBracket(res1.getEndToken().getNext(), false)) {
                res = res1;
                res.setBeginToken(t);
                res.setEndToken(res1.getEndToken().getNext());
            }
        }
        if (res == null && (t instanceof com.pullenti.ner.TextToken) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.TextToken.class)).term.startsWith("ЖИЛ")) {
            com.pullenti.ner.Token tt = t.getNext();
            if (tt != null && tt.isCharOf(".\\/-")) 
                tt = tt.getNext();
            AddressItemToken res1 = _tryParsePureItem(tt, false, prev);
            if (res1 != null) {
                res1.setBeginToken(t);
                res = res1;
            }
        }
        if ((res == null && prev != null && t.getLengthChar() == 1) && t.isValue("С", null)) {
            if (prev.getTyp() == AddressItemType.CORPUS || prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.STREET) {
                AddressItemToken _next = _tryParsePureItem(t.getNext(), false, null);
                if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                    _next.setTyp(AddressItemType.BUILDING);
                    _next.setBeginToken(t);
                    res = _next;
                }
            }
        }
        if (res != null && res.getTyp() == AddressItemType.DETAIL) {
        }
        else {
            AddressItemToken det = _tryAttachDetail(t, null);
            if (res == null) 
                res = det;
            else if (det != null && det.getEndChar() > res.getEndChar()) 
                res = det;
        }
        if ((res != null && !com.pullenti.unisharp.Utils.isNullOrEmpty(res.value) && Character.isDigit(res.value.charAt(res.value.length() - 1))) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res)) {
            com.pullenti.ner.Token t1 = res.getEndToken().getNext();
            if (((t1 instanceof com.pullenti.ner.TextToken) && (t1.getWhitespacesBeforeCount() < 3) && t1.chars.isLetter()) && t1.getLengthChar() == 1) {
                AddressItemToken res2 = _tryParsePureItem(t1, false, null);
                if (res2 == null) {
                    StreetItemToken sit = StreetItemToken.tryParse(t1, null, false, null);
                    if (sit != null && sit.typ == StreetItemType.NOUN) {
                    }
                    else if (t1.isValue2("В", "ГРАНИЦА")) {
                    }
                    else {
                        String ch = correctCharToken(t1);
                        if (com.pullenti.ner.geo.internal.OrgTypToken.tryParse(t1, false, null) != null) 
                            ch = null;
                        if (ch != null && com.pullenti.unisharp.Utils.stringsNe(ch, "К") && com.pullenti.unisharp.Utils.stringsNe(ch, "С")) {
                            res.value = (res.value + ch);
                            res.setEndToken(t1);
                        }
                    }
                }
            }
        }
        if ((res != null && res.getTyp() == AddressItemType.NUMBER && res.getEndToken().getNext() != null) && res.getEndToken().getNext().isValue("ДОЛЯ", null)) {
            res.setEndToken(res.getEndToken().getNext());
            res.setTyp(AddressItemType.PART);
            res.value = "1";
        }
        if (res == null && t.getMorphClassInDictionary().isPreposition()) {
            AddressItemToken _next = tryParsePureItem(t.getNext(), null, null);
            if (_next != null && _next.getTyp() != AddressItemType.NUMBER && !t.getNext().isValue("СТ", null)) {
                _next.setBeginToken(t);
                res = _next;
            }
        }
        if (res != null && ((res.getTyp() == AddressItemType.NUMBER || res.getTyp() == AddressItemType.HOUSE || res.getTyp() == AddressItemType.PLOT))) {
            com.pullenti.ner.Token tt = res.getEndToken().getNext();
            if (tt != null && tt.isHiphen()) 
                tt = tt.getNext();
            if (tt != null && tt.isValue("ЛПХ", null)) 
                res.setEndToken(tt);
            if (tt != null && tt.isCharOf("\\/")) 
                tt = tt.getNext();
            if ((tt instanceof com.pullenti.ner.TextToken) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.length() == 2) {
                if (((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.charAt(1) == 'П' || ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.charAt(1) == 'С') {
                    AddressItemToken ne = _tryParsePureItem(tt, false, null);
                    if (ne == null || ne.getEndToken() == tt) 
                        res.setEndToken(tt);
                }
            }
        }
        if (res != null && res.value != null) 
            res._corrNum();
        ad.level--;
        return res;
    }

    private static AddressItemToken _tryParsePureItem(com.pullenti.ner.Token t, boolean prefixBefore, AddressItemToken prev) {
        if (t instanceof com.pullenti.ner.NumberToken) {
            com.pullenti.ner.NumberToken n = (com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.NumberToken.class);
            if (((n.getLengthChar() == 6 || ((n.getLengthChar() == 5 && t.kit.baseLanguage.isUa())))) && n.typ == com.pullenti.ner.NumberSpellingType.DIGIT && !n.getMorph()._getClass().isAdjective()) 
                return _new84(AddressItemType.ZIP, t, t, n.getValue().toString());
            if ((!t.isWhitespaceAfter() && t.getNext() != null && t.getNext().isCharOf(":")) && !t.getNext().isWhitespaceAfter() && (t.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
                return null;
            boolean ok = false;
            if ((t.getPrevious() != null && t.getPrevious().getMorph()._getClass().isPreposition() && t.getNext() != null) && t.getNext().chars.isLetter() && t.getNext().chars.isAllLower()) 
                ok = true;
            else if (t.getMorph()._getClass().isAdjective() && !t.getMorph()._getClass().isNoun()) 
                ok = true;
            com.pullenti.ner.core.TerminToken tok0 = m_Ontology.tryParse(t.getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
            if (tok0 != null && (tok0.termin.tag instanceof AddressItemType)) {
                AddressItemType typ0 = (AddressItemType)tok0.termin.tag;
                if (tok0.getEndToken().getNext() == null || tok0.getEndToken().isNewlineAfter()) 
                    ok = true;
                else if (tok0.getEndToken().getNext().isComma() && (tok0.getEndToken().getNext().getNext() instanceof com.pullenti.ner.NumberToken) && typ0 == AddressItemType.FLAT) 
                    return _new84(AddressItemType.HOUSE, t, t, n.getValue());
                if (t.getPrevious() != null && t.getPrevious().isComma() && tok0.getLengthChar() > 1) {
                    com.pullenti.ner.Token tt = tok0.getEndToken().getNext();
                    if (tt == null || tt.isComma() || tok0.isNewlineAfter()) 
                        return _new84(typ0, t, tok0.getEndToken(), n.getValue());
                }
                if (typ0 == AddressItemType.FLAT) {
                    if ((t.getNext() instanceof com.pullenti.ner.TextToken) && t.getNext().isValue("КВ", null)) {
                        if (com.pullenti.unisharp.Utils.stringsEq(t.getNext().getSourceText(), "кВ") && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) 
                            return null;
                        StreetItemToken si = StreetItemToken.tryParse(t.getNext(), null, false, null);
                        if (si != null && si.typ == StreetItemType.NOUN && si.getEndChar() > tok0.getEndChar()) 
                            return null;
                        com.pullenti.ner.core.NumberExToken suf = com.pullenti.ner.core.NumberHelper.tryParsePostfixOnly(t.getNext());
                        if (suf != null) 
                            return null;
                    }
                    if ((tok0.getEndToken().getNext() instanceof com.pullenti.ner.NumberToken) && (tok0.getEndToken().getWhitespacesAfterCount() < 3)) {
                        if (prev != null && ((prev.getTyp() == AddressItemType.STREET || prev.getTyp() == AddressItemType.CITY))) 
                            return _new84(AddressItemType.NUMBER, t, t, n.getValue().toString());
                    }
                }
                if (tok0.getEndToken().getNext() instanceof com.pullenti.ner.NumberToken) {
                }
                else if (tok0.getEndToken().getNext() != null && tok0.getEndToken().getNext().isValue("НЕТ", null)) {
                }
                else if ((((typ0 == AddressItemType.KILOMETER || typ0 == AddressItemType.FLOOR || typ0 == AddressItemType.BLOCK) || typ0 == AddressItemType.POTCH || typ0 == AddressItemType.FLAT) || typ0 == AddressItemType.PLOT || typ0 == AddressItemType.BOX) || typ0 == AddressItemType.OFFICE) {
                    AddressItemToken _next = _tryParsePureItem(tok0.getEndToken().getNext(), false, null);
                    if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                    }
                    else if (tok0.getEndToken().isValue("ПОД", null)) {
                    }
                    else {
                        _next = _tryParsePureItem(tok0.getEndToken(), false, null);
                        if (_next != null && _next.value != null && com.pullenti.unisharp.Utils.stringsNe(_next.value, "0")) {
                        }
                        else 
                            return _new84(typ0, t, tok0.getEndToken(), n.getValue().toString());
                    }
                }
            }
        }
        boolean prepos = false;
        com.pullenti.ner.core.TerminToken tok = null;
        if (t != null && t.getMorph()._getClass().isPreposition()) {
            if ((((tok = m_Ontology.tryParse(t, com.pullenti.ner.core.TerminParseAttr.NO)))) == null) {
                if (t.getBeginChar() < t.getEndChar()) 
                    return null;
                if (t.isValue("В", null) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
                    com.pullenti.ner.Token tt = t.getNext();
                    if (tt != null && tt.isChar('.')) 
                        tt = tt.getNext();
                    com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(tt, com.pullenti.ner.geo.internal.GeoTokenType.HOUSE);
                    if (num1 != null) {
                        for (com.pullenti.ner.Token tt0 = t.getPrevious(); tt0 != null; tt0 = tt0.getPrevious()) {
                            if (tt0.isValue("КВАРТАЛ", null) || tt0.isValue("КВ", null) || tt0.isValue("ЛЕСНИЧЕСТВО", null)) 
                                return _new84(AddressItemType.PLOT, t, num1.getEndToken(), num1.value);
                            if (tt0.isNewlineBefore()) 
                                break;
                        }
                    }
                }
                if (!t.isCharOf("КСкс")) 
                    t = t.getNext();
                prepos = true;
            }
        }
        if (t == null) 
            return null;
        if ((((t instanceof com.pullenti.ner.TextToken) && t.getLengthChar() == 1 && t.chars.isLetter()) && !t.isValue("V", null) && !t.isValue("I", null)) && !t.isValue("X", null)) {
            if (t.getPrevious() != null && t.getPrevious().isComma()) {
                if (((t.getNext() != null && t.getNext().isComma() && (t.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) && t.isValue("Д", null) && prev != null) && prev.getTyp() == AddressItemType.STREET) {
                }
                else if (t.isNewlineAfter() || t.getNext().isComma()) 
                    return _new211(AddressItemType.BUILDING, t, t, com.pullenti.ner.address.AddressBuildingType.LITER, ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t, com.pullenti.ner.TextToken.class)).term);
            }
        }
        if (com.pullenti.ner.core.BracketHelper.isBracket(t, true)) {
            com.pullenti.ner.core.BracketSequenceToken br = com.pullenti.ner.core.BracketHelper.tryParse(t, com.pullenti.ner.core.BracketParseAttr.NO, 100);
            if ((br != null && (t.getNext() instanceof com.pullenti.ner.TextToken) && t.getNext().getLengthChar() <= 2) && t.getNext().getNext() == br.getEndToken() && t.getNext().getLengthChar() == 1) 
                return _new211(AddressItemType.BUILDING, t, br.getEndToken(), com.pullenti.ner.address.AddressBuildingType.LITER, ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t.getNext(), com.pullenti.ner.TextToken.class)).term);
        }
        if (t.isChar('/')) {
            AddressItemToken _next = tryParsePureItem(t.getNext(), prev, null);
            if (_next != null && _next.getEndToken().getNext() != null && _next.getEndToken().getNext().isChar('/')) {
                _next.setBeginToken(t);
                _next.setEndToken(_next.getEndToken().getNext());
                return _next;
            }
            if (_next != null && _next.getEndToken().isChar('/')) {
                _next.setBeginToken(t);
                return _next;
            }
        }
        if (tok == null) 
            tok = m_Ontology.tryParse(t, com.pullenti.ner.core.TerminParseAttr.NO);
        com.pullenti.ner.Token t1 = t;
        AddressItemType _typ = AddressItemType.NUMBER;
        com.pullenti.ner.address.AddressHouseType houseTyp = com.pullenti.ner.address.AddressHouseType.UNDEFINED;
        com.pullenti.ner.address.AddressBuildingType buildTyp = com.pullenti.ner.address.AddressBuildingType.UNDEFINED;
        String spaceDetail = null;
        boolean hasNumPrefix = false;
        com.pullenti.ner.core.TerminToken tok00 = tok;
        if (tok != null) {
            if (t.isValue("УЖЕ", null)) 
                return null;
            if (t.isValue("ЛИТЕРА", null)) {
                String str = t.getSourceText();
                if (Character.isUpperCase(str.charAt(str.length() - 1)) && Character.isLowerCase(str.charAt(str.length() - 2))) 
                    return _new211(AddressItemType.BUILDING, t, t, com.pullenti.ner.address.AddressBuildingType.LITER, str.substring(str.length() - 1));
            }
            if (t.isValue("ПОД", null) && tok.getEndToken() == t) {
                if (!(t.getNext() instanceof com.pullenti.ner.NumberToken)) 
                    return null;
            }
            if ((tok.getLengthChar() == 1 && t.getNext() != null && t.getNext().isHiphen()) && (t.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
                return null;
            if (t.isValue("НОМЕР", null)) 
                hasNumPrefix = true;
            if (com.pullenti.unisharp.Utils.stringsEq(tok.termin.getCanonicText(), "ТАМ ЖЕ")) {
                int cou = 0;
                for (com.pullenti.ner.Token tt = t.getPrevious(); tt != null; tt = tt.getPrevious()) {
                    if (cou > 1000) 
                        break;
                    com.pullenti.ner.Referent r = tt.getReferent();
                    if (r == null) 
                        continue;
                    if (r instanceof com.pullenti.ner.address.AddressReferent) {
                        com.pullenti.ner.geo.GeoReferent g = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(r.getSlotValue(com.pullenti.ner.address.AddressReferent.ATTR_GEO), com.pullenti.ner.geo.GeoReferent.class);
                        if (g != null) 
                            return _new85(AddressItemType.CITY, t, tok.getEndToken(), g);
                        break;
                    }
                    else if (r instanceof com.pullenti.ner.geo.GeoReferent) {
                        com.pullenti.ner.geo.GeoReferent g = (com.pullenti.ner.geo.GeoReferent)com.pullenti.unisharp.Utils.cast(r, com.pullenti.ner.geo.GeoReferent.class);
                        if (!g.isState()) 
                            return _new85(AddressItemType.CITY, t, tok.getEndToken(), g);
                    }
                }
                return null;
            }
            if (tok.termin.tag instanceof com.pullenti.ner.address.AddressDetailType) 
                return _tryAttachDetail(t, tok);
            t1 = tok.getEndToken().getNext();
            if ((t1 instanceof com.pullenti.ner.TextToken) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.startsWith("ОБ")) {
                tok.setEndToken(t1);
                t1 = t1.getNext();
                if (t1 != null && t1.isChar('.')) {
                    tok.setEndToken(t1);
                    t1 = t1.getNext();
                }
            }
            boolean build = false;
            if (com.pullenti.unisharp.Utils.stringsEq(tok.termin.getCanonicText(), "НЕЖИЛОЕ")) {
                for (; t1 != null; t1 = t1.getNext()) {
                    if (t1.isChar('.')) 
                        continue;
                    if (t1.isValue("ВСТР", null) || t1.isValue("ВСТРОЕН", null) || t1.isValue("ВСТРОЕННЫЙ", null)) 
                        continue;
                    if (t1.isValue("ЗДАНИЕ", null)) {
                        build = true;
                        continue;
                    }
                    if (build) {
                        if ((t1.isComma() || t1.isValue("В", null) || t1.isValue("ЧАСТЬ", null)) || t1.isValue("НЕЖИЛОЙ", null)) 
                            continue;
                    }
                    com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(t1, com.pullenti.ner.core.TerminParseAttr.NO);
                    if (tok2 == null) 
                        break;
                    if (com.pullenti.unisharp.Utils.stringsEq(tok2.termin.getCanonicText(), "ПОМЕЩЕНИЕ")) {
                        t1 = tok2.getEndToken().getNext();
                        _typ = AddressItemType.SPACE;
                    }
                    break;
                }
            }
            if (t.isValue("ЖИЛОЙ", null) && t.getNext() != null && t.getNext().isComma()) 
                return null;
            if ((t1 != null && t1.isChar('(') && (t1.getNext() instanceof com.pullenti.ner.TextToken)) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1.getNext(), com.pullenti.ner.TextToken.class)).term.startsWith("ОБ")) {
                tok.setEndToken(t1.getNext());
                t1 = t1.getNext().getNext();
                while (t1 != null) {
                    if (t1.isCharOf(".)")) {
                        tok.setEndToken(t1);
                        t1 = t1.getNext();
                    }
                    else 
                        break;
                }
            }
            if (tok.termin.tag instanceof AddressItemType) {
                if (tok.termin.tag2 instanceof com.pullenti.ner.address.AddressHouseType) 
                    houseTyp = (com.pullenti.ner.address.AddressHouseType)tok.termin.tag2;
                if (tok.termin.tag2 instanceof com.pullenti.ner.address.AddressBuildingType) 
                    buildTyp = (com.pullenti.ner.address.AddressBuildingType)tok.termin.tag2;
                _typ = (AddressItemType)tok.termin.tag;
                if (_typ == AddressItemType.CORPUSORFLAT && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamNoFlats(tok)) 
                    _typ = AddressItemType.CORPUS;
                if (_typ == AddressItemType.PLOT) {
                    if (t.getPrevious() != null && ((t.getPrevious().isValue("СУДЕБНЫЙ", "СУДОВИЙ") || t.getPrevious().isValue("ИЗБИРАТЕЛЬНЫЙ", "ВИБОРЧИЙ")))) 
                        return null;
                }
                if (_typ == AddressItemType.SPACE && tok.getBeginToken() == tok.getEndToken() && t.getMorphClassInDictionary().isAdjective()) {
                    if (StreetItemToken.checkKeyword(t.getNext())) 
                        return null;
                    if (prev == null) 
                        return null;
                    if ((prev.getTyp() != AddressItemType.HOUSE && prev.getTyp() != AddressItemType.CORPUS && prev.getTyp() != AddressItemType.BUILDING) && prev.getTyp() != AddressItemType.CORPUSORFLAT) 
                        return null;
                }
                if (t1 != null && t1.isCharOf("\\/") && m_Ontology.tryParse(t1.getNext(), com.pullenti.ner.core.TerminParseAttr.NO) != null) {
                    java.util.ArrayList<AddressItemToken> resList = new java.util.ArrayList<AddressItemToken>();
                    resList.add(new AddressItemToken(_typ, t, t1));
                    com.pullenti.ner.Token tt;
                    for (tt = t1.getNext(); tt != null; tt = tt.getNext()) {
                        com.pullenti.ner.core.TerminToken tok1 = m_Ontology.tryParse(tt, com.pullenti.ner.core.TerminParseAttr.NO);
                        if (tok1 == null) 
                            break;
                        if (!(tok1.termin.tag instanceof AddressItemType)) 
                            break;
                        resList.add(new AddressItemToken((AddressItemType)tok1.termin.tag, tt, tok1.getEndToken()));
                        tt = tok1.getEndToken();
                        tt = tt.getNext();
                        if (tt == null || !tt.isCharOf("\\/")) 
                            break;
                    }
                    if (resList.size() > 1 && tt != null) {
                        for (int i = 0; i < resList.size(); i++) {
                            com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(tt, com.pullenti.ner.geo.internal.GeoTokenType.TOSLASH);
                            if (nn == null) 
                                break;
                            resList.get(i).setEndToken(nn.getEndToken());
                            resList.get(i).value = nn.value;
                            if (i > 0) 
                                resList.get(i).setBeginToken(tt);
                            if (i == (resList.size() - 1)) {
                                for (int j = resList.size() - 2; j >= 0; j--) {
                                    resList.get(j).altTyp = resList.get(j + 1);
                                }
                                return resList.get(0);
                            }
                            tt = nn.getEndToken().getNext();
                            if (tt == null || !tt.isCharOf("\\/")) 
                                break;
                            tt = tt.getNext();
                        }
                    }
                }
                if (_typ == AddressItemType.FLOOR && (tok.termin.tag3 instanceof String)) 
                    return _new84(_typ, t, tok.getEndToken(), (String)com.pullenti.unisharp.Utils.cast(tok.termin.tag3, String.class));
                if (_typ == AddressItemType.FLOOR && (tok.getEndToken().getNext() instanceof com.pullenti.ner.TextToken)) {
                    if (tok.getEndToken().getNext().isHiphen() && !tok.getEndToken().getNext().isWhitespaceAfter() && (tok.getEndToken().getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
                        return _new84(_typ, t, tok.getEndToken().getNext().getNext(), "-" + ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(tok.getEndToken().getNext().getNext(), com.pullenti.ner.NumberToken.class)).getValue());
                    if ((tok.getEndToken().getNext().getLengthChar() == 1 && tok.getEndToken().getNext().chars.isAllUpper() && (tok.getEndToken().getNext().getNext() instanceof com.pullenti.ner.NumberToken)) && !tok.getEndToken().getNext().isWhitespaceAfter()) 
                        return _new84(_typ, t, tok.getEndToken().getNext().getNext(), ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tok.getEndToken().getNext(), com.pullenti.ner.TextToken.class)).term + ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(tok.getEndToken().getNext().getNext(), com.pullenti.ner.NumberToken.class)).getValue());
                }
                if (_typ == AddressItemType.HOUSE && houseTyp == com.pullenti.ner.address.AddressHouseType.SPECIAL) {
                    com.pullenti.ner.Token tt2 = tok.getEndToken().getNext();
                    if (tt2 != null && tt2.isHiphen()) 
                        tt2 = tt2.getNext();
                    AddressItemToken res = _new219(_typ, t, tok.getEndToken(), houseTyp, (tok.termin.acronym != null ? tok.termin.acronym : tok.termin.getCanonicText()));
                    com.pullenti.ner.geo.internal.NumToken num2 = com.pullenti.ner.geo.internal.NumToken.tryParse(tt2, com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                    if (num2 != null && (tt2.getWhitespacesBeforeCount() < 2)) {
                        res.value = (res.value + "-" + num2.value);
                        res.setEndToken(num2.getEndToken());
                    }
                    return res;
                }
                if (_typ == AddressItemType.FLAT && t.isValue("КВ", null)) {
                    StreetItemToken sit = StreetItemToken.tryParse(t, null, false, null);
                    if (sit != null && sit.getEndChar() > tok.getEndChar()) 
                        return null;
                }
                if (_typ == AddressItemType.PREFIX) {
                    for (; t1 != null; t1 = t1.getNext()) {
                        if (((t1.getMorph()._getClass().isPreposition() || t1.getMorph()._getClass().isConjunction())) && t1.getWhitespacesAfterCount() == 1) 
                            continue;
                        if (t1.isChar(':')) {
                            t1 = t1.getNext();
                            break;
                        }
                        if (t1.isChar('(')) {
                            com.pullenti.ner.core.BracketSequenceToken br = com.pullenti.ner.core.BracketHelper.tryParse(t1, com.pullenti.ner.core.BracketParseAttr.NO, 100);
                            if (br != null && (br.getLengthChar() < 50)) {
                                t1 = br.getEndToken();
                                continue;
                            }
                        }
                        if (t1 instanceof com.pullenti.ner.TextToken) {
                            if (t1.chars.isAllLower() || (t1.getWhitespacesBeforeCount() < 3)) {
                                com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.geo.internal.MiscLocationHelper.tryParseNpt(t1);
                                if (npt != null && ((npt.chars.isAllLower() || npt.getMorph().getCase().isGenitive()))) {
                                    if (com.pullenti.ner.geo.internal.CityItemToken.checkKeyword(npt.getEndToken()) == null && com.pullenti.ner.geo.internal.TerrItemToken.checkKeyword(npt.getEndToken()) == null && !StreetItemToken.checkKeyword(npt.getEndToken())) {
                                        t1 = npt.getEndToken();
                                        continue;
                                    }
                                }
                            }
                        }
                        if (t1.isValue("УКАЗАННЫЙ", null) || t1.isValue("ЕГРИП", null) || t1.isValue("ФАКТИЧЕСКИЙ", null)) 
                            continue;
                        if (t1.isComma()) {
                            if (t1.getNext() != null && t1.getNext().isValue("УКАЗАННЫЙ", null)) 
                                continue;
                        }
                        break;
                    }
                    if (t1 != null) {
                        com.pullenti.ner.Token t0 = t;
                        if (((t0.getPrevious() != null && !t0.isNewlineBefore() && t0.getPrevious().isChar(')')) && (t0.getPrevious().getPrevious() instanceof com.pullenti.ner.TextToken) && t0.getPrevious().getPrevious().getPrevious() != null) && t0.getPrevious().getPrevious().getPrevious().isChar('(')) {
                            t = t0.getPrevious().getPrevious().getPrevious().getPrevious();
                            if (t != null && t.getMorphClassInDictionary().isAdjective() && !t.isNewlineAfter()) 
                                t0 = t;
                        }
                        if (t0.getBeginChar() > t1.getPrevious().getBeginChar()) 
                            return null;
                        AddressItemToken res = new AddressItemToken(AddressItemType.PREFIX, t0, t1.getPrevious());
                        for (com.pullenti.ner.Token tt = t0.getPrevious(); tt != null; tt = tt.getPrevious()) {
                            if (tt.getNewlinesAfterCount() > 3) 
                                break;
                            if (tt.isCommaAnd() || tt.isCharOf("().")) 
                                continue;
                            if (!(tt instanceof com.pullenti.ner.TextToken)) 
                                break;
                            if (((tt.isValue("ПОЧТОВЫЙ", null) || tt.isValue("ЮРИДИЧЕСКИЙ", null) || tt.isValue("ЮР", null)) || tt.isValue("ФАКТИЧЕСКИЙ", null) || tt.isValue("ФАКТ", null)) || tt.isValue("ПОЧТ", null) || tt.isValue("АДРЕС", null)) 
                                res.setBeginToken(tt);
                            else 
                                break;
                        }
                        return res;
                    }
                    else 
                        return null;
                }
                else if ((_typ == AddressItemType.CORPUSORFLAT && !tok.isWhitespaceBefore() && !tok.isWhitespaceAfter()) && tok.getBeginToken() == tok.getEndToken() && tok.getBeginToken().isValue("К", null)) {
                    if (prev != null && prev.getTyp() == AddressItemType.FLAT) 
                        _typ = AddressItemType.ROOM;
                    else 
                        _typ = AddressItemType.CORPUS;
                }
                if (_typ == AddressItemType.DETAIL && t.isValue("У", null)) {
                    if (!com.pullenti.ner.geo.internal.MiscLocationHelper.checkGeoObjectBefore(t, false)) 
                        return null;
                }
                if (_typ == AddressItemType.FLAT && t.isValue("КВ", null)) {
                    if (com.pullenti.unisharp.Utils.stringsEq(t.getSourceText(), "кВ")) 
                        return null;
                }
                if (((_typ == AddressItemType.FLAT || _typ == AddressItemType.SPACE || _typ == AddressItemType.OFFICE)) && !(tok.getEndToken().getNext() instanceof com.pullenti.ner.NumberToken)) {
                    com.pullenti.ner.Token tt2 = tok.getEndToken().getNext();
                    if (tt2 != null && tt2.isCharOf("\\/")) 
                        tt2 = tt2.getNext();
                    AddressItemToken _next = _tryParsePureItem(tt2, false, null);
                    if ((_next == null && _typ == AddressItemType.SPACE && tt2 != null) && tt2.isChar('(')) {
                        AddressItemToken next2 = _tryParsePureItem(tt2.getNext(), false, null);
                        if (next2 != null && next2.getEndToken().getNext() != null && next2.getEndToken().getNext().isChar(')')) {
                            next2.setBeginToken(t);
                            next2.setEndToken(next2.getEndToken().getNext());
                            return next2;
                        }
                    }
                    if (_next != null && _typ != AddressItemType.OFFICE && _next.getTyp() == AddressItemType.FLAT) {
                        _next.setBeginToken(t);
                        return _next;
                    }
                    if (_next != null && _typ == AddressItemType.FLAT && _next.getTyp() == AddressItemType.OFFICE) {
                        _next.setBeginToken(t);
                        return _next;
                    }
                    if (_next != null && _next.getTyp() == AddressItemType.BUILDING && _next.buildingType == com.pullenti.ner.address.AddressBuildingType.LITER) 
                        return _new84(_typ, t, _next.getEndToken(), _next.value);
                    if (_next != null && ((_next.getTyp() == AddressItemType.CORPUS || _next.getTyp() == AddressItemType.HOUSE)) && _next.getBeginToken().getLengthChar() == 1) 
                        return _new84(_typ, t, _next.getEndToken(), ((_next.getTyp() == AddressItemType.CORPUS ? "К" : "Д") + _next.value));
                    if (_next != null && _typ == AddressItemType.OFFICE && ((_next.getTyp() == AddressItemType.SPACE || _next.getTyp() == AddressItemType.FLAT))) {
                        _next.setTyp(AddressItemType.OFFICE);
                        _next.setBeginToken(t);
                        return _next;
                    }
                    if (tok.getEndToken().getNext() != null && tok.getEndToken().getNext().isChar('(')) {
                        com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(tok.getEndToken().getNext().getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                        if (tok2 != null && tok2.getEndToken().getNext() != null && tok2.getEndToken().getNext().isChar(')')) 
                            t1 = tok2.getEndToken().getNext().getNext();
                    }
                }
                if (_typ == AddressItemType.SPACE && tok.termin.tag3 != null) {
                    if (prev != null && ((prev.getTyp() == AddressItemType.STREET || prev.getTyp() == AddressItemType.CITY))) 
                        _typ = AddressItemType.HOUSE;
                    else if (prev != null && ((prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.BUILDING || prev.getTyp() == AddressItemType.CORPUS))) {
                    }
                    else {
                    }
                    if (tok.termin.tag2 != null) {
                        spaceDetail = tok.termin.getCanonicText();
                        if (spaceDetail.length() > 4 || com.pullenti.unisharp.Utils.stringsEq(spaceDetail, "КАФЕ")) 
                            spaceDetail = spaceDetail.toLowerCase();
                        com.pullenti.ner.geo.internal.OrgItemToken org1 = com.pullenti.ner.geo.internal.OrgItemToken.tryParse(t, null);
                        if (org1 != null && org1.isBuilding) 
                            return _new222(_typ, t, org1.getEndToken(), spaceDetail, org1);
                    }
                }
                if (_typ == AddressItemType.SPACE) {
                    if (tok.termin.tag2 != null) {
                        spaceDetail = tok.termin.getCanonicText();
                        if (spaceDetail.length() > 4 || com.pullenti.unisharp.Utils.stringsEq(spaceDetail, "КАФЕ")) 
                            spaceDetail = spaceDetail.toLowerCase();
                        com.pullenti.ner.geo.internal.OrgItemToken org1 = com.pullenti.ner.geo.internal.OrgItemToken.tryParse(t, null);
                        if (org1 != null && org1.isBuilding) 
                            return _new222(_typ, t, org1.getEndToken(), spaceDetail, org1);
                    }
                    AddressItemToken _next = _tryParsePureItem(tok.getEndToken().getNext(), false, null);
                    if (_next == null && tok.getEndToken().getNext() != null && tok.getEndToken().getNext().isHiphen()) 
                        _next = _tryParsePureItem(tok.getEndToken().getNext().getNext(), false, null);
                    if (_next != null && ((_next.getTyp() == AddressItemType.SPACE || _next.getTyp() == AddressItemType.ROOM || _next.getTyp() == AddressItemType.OFFICE))) {
                        _next.setBeginToken(t);
                        if (_next.detailParam == null) 
                            _next.detailParam = spaceDetail;
                        return _next;
                    }
                    com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(tok.getEndToken().getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                    if (tok2 == null && tok.getEndToken().getNext() != null && tok.getEndToken().getNext().isHiphen()) 
                        tok2 = m_Ontology.tryParse(tok.getEndToken().getNext().getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                    if ((tok2 != null && tok2.termin.tag != null && ((AddressItemType)tok2.termin.tag) == AddressItemType.SPACE) && tok2.termin.tag2 != null) {
                        spaceDetail = tok2.termin.getCanonicText();
                        if (spaceDetail.length() > 4) 
                            spaceDetail = spaceDetail.toLowerCase();
                        tok = tok2;
                        tok.setBeginToken(t);
                    }
                    if ((tok.getEndToken().getNext() instanceof com.pullenti.ner.TextToken) && com.pullenti.unisharp.Utils.stringsEq(((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tok.getEndToken().getNext(), com.pullenti.ner.TextToken.class)).term, "ЗОИ")) 
                        return _new224(_typ, t, tok.getEndToken().getNext(), "3", "МОП");
                }
                if (_typ == AddressItemType.FLOOR && t1 != null) {
                    AddressItemToken _next = _tryParsePureItem(t1, false, null);
                    if (_next != null && _next.getTyp() == _typ) {
                        _next.setBeginToken(t);
                        return _next;
                    }
                    com.pullenti.ner.Token tt2 = t1;
                    if (tt2 != null && tt2.isCharOf("\\/")) 
                        tt2 = tt2.getNext();
                    _next = _tryParsePureItem(tt2, prefixBefore, prev);
                    if (_next != null && com.pullenti.unisharp.Utils.stringsEq(_next.value, "подвал")) {
                        tt2 = _next.getEndToken().getNext();
                        if (tt2 != null && tt2.isCharOf("\\/")) 
                            tt2 = tt2.getNext();
                        AddressItemToken num2 = _tryParsePureItem(tt2, prefixBefore, prev);
                        if (num2 != null && num2.getTyp() == AddressItemType.NUMBER && num2.value != null) {
                            num2.setTyp(_typ);
                            num2.setBeginToken(t);
                            num2.value = "-" + num2.value;
                            return num2;
                        }
                    }
                }
                if (_typ == AddressItemType.KILOMETER || _typ == AddressItemType.FLOOR || _typ == AddressItemType.POTCH) {
                    if ((tok.getEndToken().getNext() instanceof com.pullenti.ner.NumberToken) || com.pullenti.ner.core.MiscHelper.checkNumberPrefix(tok.getEndToken().getNext()) != null) {
                    }
                    else 
                        return new AddressItemToken(_typ, t, tok.getEndToken());
                }
                if ((_typ == AddressItemType.HOUSE || _typ == AddressItemType.BUILDING || _typ == AddressItemType.CORPUS) || _typ == AddressItemType.PLOT || _typ == AddressItemType.BOX) {
                    for (com.pullenti.ner.Token tt2 = t1; tt2 != null; tt2 = tt2.getNext()) {
                        if (tt2.isComma()) 
                            continue;
                        if (tt2.isValue("РАСПОЛОЖЕННЫЙ", null) || tt2.isValue("НАХОДЯЩИЙСЯ", null) || tt2.isValue("ПРИЛЕГАЮЩИЙ", null)) 
                            continue;
                        if (tt2.isValue("ПОДВАЛ", null)) {
                            t1 = tt2.getNext();
                            continue;
                        }
                        if (tt2.getMorph()._getClass().isPreposition()) 
                            continue;
                        com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(tt2, com.pullenti.ner.core.TerminParseAttr.NO);
                        if (tok2 != null && (tok2.termin.tag instanceof AddressItemType)) {
                            AddressItemType typ2 = (AddressItemType)tok2.termin.tag;
                            if (typ2 != _typ && ((typ2 == AddressItemType.PLOT || ((typ2 == AddressItemType.HOUSE && _typ == AddressItemType.PLOT))))) {
                                if (t.getBeginChar() > tt2.getPrevious().getBeginChar()) 
                                    return null;
                                return _new225(_typ, t, tt2.getPrevious(), "0", houseTyp);
                            }
                            if (_typ == AddressItemType.BOX && typ2 == AddressItemType.SPACE && com.pullenti.unisharp.Utils.stringsEq(tok2.termin.getCanonicText(), "ПОДВАЛ")) {
                                tt2 = tok2.getEndToken();
                                t1 = tt2.getNext();
                                continue;
                            }
                            if (_typ == AddressItemType.CORPUS && typ2 == AddressItemType.HOUSE && (tok2.termin.tag2 instanceof com.pullenti.ner.address.AddressHouseType)) {
                                com.pullenti.ner.address.AddressHouseType ht = (com.pullenti.ner.address.AddressHouseType)tok2.termin.tag2;
                                if (ht == com.pullenti.ner.address.AddressHouseType.ESTATE || ht == com.pullenti.ner.address.AddressHouseType.HOUSEESTATE) {
                                    tt2 = tok2.getEndToken();
                                    t1 = tt2.getNext();
                                    continue;
                                }
                            }
                        }
                        if (tt2 instanceof com.pullenti.ner.TextToken) {
                            if (((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt2, com.pullenti.ner.TextToken.class)).term.startsWith("ДОП")) {
                                t1 = tt2.getNext();
                                if (t1 != null && t1.isChar('.')) {
                                    tt2 = tt2.getNext();
                                    t1 = t1.getNext();
                                }
                                continue;
                            }
                        }
                        break;
                    }
                    if (_typ == AddressItemType.CORPUS) {
                        if (t1 != null) {
                            if (t1.isValue("СЕКТОР", null) || t1.isValue("МАССИВ", null)) 
                                t1 = t1.getNext();
                            else if (t1.isValue("СЕКТ", null) || t1.isValue("МАС", null)) {
                                t1 = t1.getNext();
                                if (t1 != null && t1.isChar('.')) 
                                    t1 = t1.getNext();
                            }
                            else {
                                AddressItemToken _next = tryParsePureItem(t1, null, null);
                                if (_next != null && ((_next.getTyp() == AddressItemType.CORPUS || _next.getTyp() == AddressItemType.FLAT || _next.getTyp() == AddressItemType.CORPUSORFLAT))) {
                                    _next.setTyp(AddressItemType.CORPUS);
                                    _next.setBeginToken(t);
                                    return _next;
                                }
                                if (_next != null && _next.buildingType == com.pullenti.ner.address.AddressBuildingType.LITER) {
                                    _next.setBeginToken(t);
                                    return _next;
                                }
                            }
                        }
                    }
                }
                if (_typ == AddressItemType.HOUSE && t1 != null && t1.chars.isLetter()) {
                    AddressItemToken _next = tryParsePureItem(t1, prev, null);
                    if (_next != null && ((_next.getTyp() == _typ || _next.getTyp() == AddressItemType.PLOT))) {
                        _next.setBeginToken(t);
                        return _next;
                    }
                }
                if (_typ == AddressItemType.FLAT && (t1 instanceof com.pullenti.ner.TextToken) && ((t1.isValue("М", null) || t1.isValue("M", null)))) {
                    if (t1.getNext() instanceof com.pullenti.ner.NumberToken) 
                        t1 = t1.getNext();
                    else if (t1.getNext() != null && t1.getNext().isChar('.') && (t1.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
                        t1 = t1.getNext().getNext();
                }
                if (_typ == AddressItemType.ROOM && t1 != null) {
                    if (t1.isCharOf("\\/")) {
                        AddressItemToken _next = _tryParsePureItem(t1.getNext(), prefixBefore, prev);
                        if (_next != null && ((_next.getTyp() == AddressItemType.ROOM || _next.getTyp() == AddressItemType.OFFICE))) {
                            _next.setBeginToken(t);
                            return _next;
                        }
                    }
                    else if (t1.isValue("К", null) && !t1.isWhitespaceAfter() && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) 
                        t1 = t1.getNext();
                }
                if (_typ == AddressItemType.FIELD) {
                    com.pullenti.ner.core.NumberExToken nt2 = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(t1);
                    if (nt2 != null && ((nt2.exTyp == com.pullenti.ner.core.NumberExType.METER2 || nt2.exTyp == com.pullenti.ner.core.NumberExType.GEKTAR || nt2.exTyp == com.pullenti.ner.core.NumberExType.AR))) 
                        return _new84(_typ, t, nt2.getEndToken(), nt2.toString());
                    AddressItemToken re = new AddressItemToken(_typ, t, tok.getEndToken());
                    StringBuilder nnn = new StringBuilder();
                    for (com.pullenti.ner.Token tt = tok.getEndToken().getNext(); tt != null; tt = tt.getNext()) {
                        com.pullenti.ner.NumberToken ll = com.pullenti.ner.core.NumberHelper.tryParseRoman(tt);
                        if (ll != null && ll.getIntValue() != null) {
                            if (nnn.length() > 0) 
                                nnn.append("-");
                            nnn.append(ll.getValue());
                            re.setEndToken((tt = ll.getEndToken()));
                            continue;
                        }
                        if (tt.isHiphen()) 
                            continue;
                        if (tt.isWhitespaceBefore()) 
                            break;
                        if (tt instanceof com.pullenti.ner.NumberToken) {
                            if (nnn.length() > 0) 
                                nnn.append("-");
                            nnn.append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.NumberToken.class)).getValue());
                            re.setEndToken(tt);
                            continue;
                        }
                        if ((tt instanceof com.pullenti.ner.TextToken) && tt.chars.isAllUpper()) {
                            if (nnn.length() > 0) 
                                nnn.append("-");
                            nnn.append(((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term);
                            re.setEndToken(tt);
                            continue;
                        }
                        break;
                    }
                    if (nnn.length() > 0) {
                        re.value = nnn.toString();
                        return re;
                    }
                }
                if (_typ == AddressItemType.NONUMBER) 
                    return _new227(AddressItemType.NONUMBER, t, tok.getEndToken(), "0", false);
                if (_typ == AddressItemType.HOUSE || _typ == AddressItemType.PLOT) {
                    if (t1 != null && t1.isValue("ЛПХ", null)) 
                        t1 = t1.getNext();
                }
                if ((_typ != AddressItemType.NUMBER && (t1 instanceof com.pullenti.ner.TextToken) && t1.chars.isLetter()) && !t1.chars.isAllUpper()) {
                    AddressItemToken _next = tryParsePureItem(t1, null, null);
                    if ((_next != null && _next.getTyp() != AddressItemType.NUMBER && _next.getTyp() != AddressItemType.NONUMBER) && _next.value != null) {
                        _next.setBeginToken(t);
                        return _next;
                    }
                }
                if (_typ != AddressItemType.NUMBER) {
                    if (t1 == null || ((t1.isComma() && !(t1.getNext() instanceof com.pullenti.ner.NumberToken))) || ((tok.isNewlineAfter() && !(t1 instanceof com.pullenti.ner.NumberToken)))) {
                        if (((prev != null || com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t))) && !tok.isNewlineBefore()) 
                            return _new228(_typ, t, tok.getEndToken(), houseTyp, buildTyp, (spaceDetail != null || _typ == AddressItemType.PLOT ? "0" : null), spaceDetail);
                    }
                }
                if (_typ == AddressItemType.PLOT || _typ == AddressItemType.WELL) {
                    com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t1, com.pullenti.ner.geo.internal.GeoTokenType.HOUSE);
                    if (num1 != null) 
                        return _new84(_typ, t, num1.getEndToken(), num1.value);
                    if (t.isNewlineBefore()) 
                        return null;
                }
                if (_typ == AddressItemType.PLOT) {
                    com.pullenti.ner.Token tt = t1;
                    if (tt != null) {
                        if (tt.isValue("У", null) || tt.isValue("ОКОЛО", null) || tt.isValue("ПРИ", null)) 
                            tt = tt.getNext();
                    }
                    com.pullenti.ner.core.TerminToken tok1 = m_Ontology.tryParse(tt, com.pullenti.ner.core.TerminParseAttr.NO);
                    if (tok1 != null) {
                        if (tok1.termin.tag instanceof AddressItemType) {
                            AddressItemType ty1 = (AddressItemType)tok1.termin.tag;
                            if (ty1 == AddressItemType.HOUSE || ty1 == AddressItemType.BUILDING || ty1 == AddressItemType.CORPUS) {
                                if (tt.getPrevious().getBeginChar() < t.getBeginChar()) 
                                    return null;
                                return _new84(_typ, t, tt.getPrevious(), "0");
                            }
                        }
                    }
                }
                if (_typ == AddressItemType.NUMBER) {
                    com.pullenti.ner.core.TerminToken tok1 = m_Ontology.tryParse(tok.getEndToken().getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                    if (tok1 != null) {
                        if (tok1.termin.tag instanceof AddressItemType) {
                            AddressItemType ty1 = (AddressItemType)tok1.termin.tag;
                            if (ty1 != AddressItemType.NUMBER) {
                                _typ = ty1;
                                t1 = tok1.getEndToken().getNext();
                            }
                        }
                    }
                }
            }
        }
        if (t1 != null && t1.isComma()) {
            if (_typ == AddressItemType.FLAT && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) 
                t1 = t1.getNext();
            else if ((_typ == AddressItemType.HOUSE && (t1.getNext() instanceof com.pullenti.ner.NumberToken) && prev != null) && prev.getTyp() == AddressItemType.STREET) 
                t1 = t1.getNext();
        }
        if (t1 != null && t1.isChar('.') && t1.getNext() != null) {
            t1 = t1.getNext();
            if (t1.isNewlineBefore() && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t1)) 
                return null;
        }
        if (t1 != null && t1.isValue("ЛПХ", null)) {
            t1 = t1.getNext();
            if (t1 != null && t1.isHiphen()) 
                t1 = t1.getNext();
        }
        if ((t1 != null && t1 != t && ((t1.isHiphen() || t1.isCharOf("_:")))) && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) 
            t1 = t1.getNext();
        if (t1 != null && t1.isValue("МОП", null) && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) 
            t1 = t1.getNext();
        if (t1 != null && t1.isValue("НА", null)) {
            com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.core.NounPhraseHelper.tryParse(t1, com.pullenti.ner.core.NounPhraseParseAttr.PARSEPREPOSITION, 0, null);
            if (npt != null && npt.getEndToken().isValue("ПЛАН", null)) 
                t1 = npt.getEndToken().getNext();
        }
        if (t1 != null && t1.isChar(':')) {
            if (t1.isNewlineAfter() && !com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t1)) {
            }
            else 
                t1 = t1.getNext();
        }
        tok = m_Ontology.tryParse(t1, com.pullenti.ner.core.TerminParseAttr.NO);
        if (tok != null && (tok.termin.tag instanceof AddressItemType) && ((AddressItemType)tok.termin.tag) == AddressItemType.NUMBER) 
            t1 = tok.getEndToken().getNext();
        else if (tok != null && (tok.termin.tag instanceof AddressItemType) && ((AddressItemType)tok.termin.tag) == AddressItemType.NONUMBER) {
            AddressItemToken re0 = _new231(_typ, t, tok.getEndToken(), "0", houseTyp, buildTyp);
            if (!re0.isWhitespaceAfter() && (re0.getEndToken().getNext() instanceof com.pullenti.ner.NumberToken)) {
                re0.setEndToken(re0.getEndToken().getNext());
                re0.value = ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(re0.getEndToken(), com.pullenti.ner.NumberToken.class)).getValue().toString();
            }
            return re0;
        }
        else if (t1 instanceof com.pullenti.ner.TextToken) {
            String term = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term;
            if (((term.length() == 7 && term.startsWith("ЛИТЕРА"))) || ((term.length() == 6 && term.startsWith("ЛИТЕР"))) || ((term.length() == 4 && term.startsWith("ЛИТ")))) {
                String txt = t1.getSourceText();
                if (((Character.isLowerCase(txt.charAt(0)) && Character.isUpperCase(txt.charAt(txt.length() - 1)))) || term.length() == 7) {
                    AddressItemToken res1 = new AddressItemToken(AddressItemType.BUILDING, t, t1);
                    res1.buildingType = com.pullenti.ner.address.AddressBuildingType.LITER;
                    res1.value = term.substring(term.length() - 1);
                    return res1;
                }
            }
            if (term.startsWith("БЛОК") && term.length() > 4) {
                String txt = t1.getSourceText();
                if (Character.isLowerCase(txt.charAt(0)) && Character.isUpperCase(txt.charAt(4))) {
                    com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t1.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.ORG);
                    if (num1 != null) {
                        AddressItemToken res1 = new AddressItemToken(AddressItemType.BLOCK, t, num1.getEndToken());
                        res1.value = term.substring(4) + num1.value;
                        return res1;
                    }
                }
            }
            if (_typ == AddressItemType.FLAT && t1 != null) {
                com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(t1, com.pullenti.ner.core.TerminParseAttr.NO);
                if (tok2 == null && t1.isComma()) 
                    tok2 = m_Ontology.tryParse(t1.getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                if (tok2 != null && ((AddressItemType)tok2.termin.tag) == AddressItemType.FLAT) 
                    t1 = tok2.getEndToken().getNext();
            }
            if (t1 != null && t1.isValue2("СТРОИТЕЛЬНЫЙ", "НОМЕР")) 
                t1 = t1.getNext();
            com.pullenti.ner.Token ttt = com.pullenti.ner.core.MiscHelper.checkNumberPrefix(t1);
            if (ttt != null) {
                t1 = ttt;
                hasNumPrefix = true;
                if (t1.isHiphen() || t1.isChar('_')) 
                    t1 = t1.getNext();
            }
        }
        if (_typ != AddressItemType.NUMBER && t1 != null) {
            if (t1.isChar('.') && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t1)) 
                t1 = t1.getNext();
            if (t1 != null && t1.isCharOf("\\/") && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) 
                t1 = t1.getNext();
        }
        if (t != t1 && (t1 instanceof com.pullenti.ner.TextToken)) {
            com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.core.NounPhraseHelper.tryParse(t1, com.pullenti.ner.core.NounPhraseParseAttr.PARSEPREPOSITION, 0, null);
            if (npt != null && npt.getEndToken().isValue("ПЛАН", null)) 
                t1 = npt.getEndToken().getNext();
        }
        if (t1 == null) {
            if (_typ == AddressItemType.GENPLAN) 
                return _new84(_typ, t, tok00.getEndToken(), "0");
            return null;
        }
        if ((t1 == t && t.isValue("С", null) && (t.getNext() instanceof com.pullenti.ner.NumberToken)) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
            _typ = AddressItemType.BUILDING;
            buildTyp = com.pullenti.ner.address.AddressBuildingType.BUILDING;
            t1 = t.getNext();
        }
        StringBuilder num = new StringBuilder();
        com.pullenti.ner.NumberToken nt = (com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class);
        AddressItemToken re11;
        if (nt != null) {
            if (_typ == AddressItemType.ROOM || _typ == AddressItemType.CORPUSORFLAT) {
                com.pullenti.ner.core.NumberExToken nt2 = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(t1);
                if (nt2 != null && nt2.exTyp == com.pullenti.ner.core.NumberExType.METER2) 
                    return _new84(AddressItemType.ROOM, t, nt2.getEndToken(), nt2.toString());
            }
            if (_typ == AddressItemType.FIELD || _typ == AddressItemType.PLOT) {
                com.pullenti.ner.core.NumberExToken nt2 = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(t1);
                if (nt2 != null && ((nt2.exTyp == com.pullenti.ner.core.NumberExType.METER2 || nt2.exTyp == com.pullenti.ner.core.NumberExType.GEKTAR || nt2.exTyp == com.pullenti.ner.core.NumberExType.AR))) 
                    return _new84(_typ, t, nt2.getEndToken(), nt2.toString());
            }
            num.append(nt.getValue());
            if (nt.typ == com.pullenti.ner.NumberSpellingType.DIGIT || nt.typ == com.pullenti.ner.NumberSpellingType.WORDS) {
                if (((nt.getEndToken() instanceof com.pullenti.ner.TextToken) && ((com.pullenti.unisharp.Utils.stringsEq(((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(nt.getEndToken(), com.pullenti.ner.TextToken.class)).term, "Е") || com.pullenti.unisharp.Utils.stringsEq(((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(nt.getEndToken(), com.pullenti.ner.TextToken.class)).term, "И"))) && nt.getEndToken().getPrevious() == nt.getBeginToken()) && !nt.getEndToken().isWhitespaceBefore()) 
                    num.append(((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(nt.getEndToken(), com.pullenti.ner.TextToken.class)).term);
                boolean drob = false;
                boolean hiph = false;
                boolean lit = false;
                com.pullenti.ner.Token et = nt.getNext();
                if (et != null && (((et.isCharOf("\\/") || et.isValue("ДРОБЬ", null) || et.isValue("КЛ", null)) || ((et.isChar('.') && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(et) && (et.getNext() instanceof com.pullenti.ner.NumberToken)))))) {
                    AddressItemToken _next = tryParsePureItem(et.getNext(), null, null);
                    if (_next != null && _next.getTyp() != AddressItemType.NUMBER && _typ != AddressItemType.FLAT) {
                        if (_next.getTyp() == _typ && _next.value != null) {
                            _next.value = (num.toString() + "/" + _next.value);
                            _next.setBeginToken(t);
                            return _next;
                        }
                        if ((et.getNext() instanceof com.pullenti.ner.NumberToken) && et.getNext().isWhitespaceAfter()) {
                            AddressItemToken next2 = tryParsePureItem(et.getNext().getNext(), null, null);
                            if (next2 != null && next2.getTyp() != AddressItemType.NUMBER) {
                                drob = true;
                                et = et.getNext();
                            }
                            else 
                                t1 = et;
                        }
                        else 
                            t1 = et;
                    }
                    else {
                        drob = true;
                        et = et.getNext();
                    }
                    if (drob && et != null && et.isCharOf("\\/")) 
                        et = et.getNext();
                }
                else if (et != null && ((et.isHiphen() || et.isChar('_')))) {
                    hiph = true;
                    et = et.getNext();
                }
                else if ((et != null && et.isChar('.') && (et.getNext() instanceof com.pullenti.ner.NumberToken)) && !et.isWhitespaceAfter()) {
                    hiph = true;
                    et = et.getNext();
                }
                if (et instanceof com.pullenti.ner.NumberToken) {
                    if (drob) {
                        AddressItemToken _next = tryParsePureItem(et, null, null);
                        if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                            num.append("/").append(_next.value);
                            t1 = _next.getEndToken();
                            et = t1.getNext();
                            drob = false;
                        }
                        else {
                            num.append("/").append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(et, com.pullenti.ner.NumberToken.class)).getValue());
                            drob = false;
                            t1 = et;
                            et = et.getNext();
                            if (et != null && et.isCharOf("\\/") && (et.getNext() instanceof com.pullenti.ner.NumberToken)) {
                                t1 = et.getNext();
                                num.append("/").append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class)).getValue());
                                et = t1.getNext();
                            }
                        }
                    }
                    else if ((hiph && !t1.isWhitespaceAfter() && (et instanceof com.pullenti.ner.NumberToken)) && !et.isWhitespaceBefore()) {
                        AddressItemToken numm = tryParsePureItem(et, null, null);
                        if (numm != null && numm.getTyp() == AddressItemType.NUMBER) {
                            boolean merge = false;
                            if ((_typ == AddressItemType.FLAT || _typ == AddressItemType.PLOT || _typ == AddressItemType.SPACE) || _typ == AddressItemType.OFFICE) {
                                if (!hasNumPrefix) 
                                    merge = true;
                            }
                            else if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamNoFlats(et)) 
                                merge = true;
                            else if (_typ == AddressItemType.HOUSE || _typ == AddressItemType.BUILDING || _typ == AddressItemType.CORPUS) {
                                com.pullenti.ner.Token ttt = numm.getEndToken().getNext();
                                if (ttt != null && ttt.isComma()) 
                                    ttt = ttt.getNext();
                                AddressItemToken numm2 = tryParsePureItem(ttt, null, null);
                                if (numm2 != null) {
                                    if ((numm2.getTyp() == AddressItemType.FLAT || numm2.getTyp() == AddressItemType.BUILDING || ((numm2.getTyp() == AddressItemType.CORPUSORFLAT && numm2.value != null))) || numm2.getTyp() == AddressItemType.CORPUS) 
                                        merge = true;
                                }
                            }
                            if (merge) {
                                num.append("/").append(numm.value);
                                t1 = numm.getEndToken();
                                et = t1.getNext();
                                hiph = false;
                            }
                        }
                    }
                }
                else if (et != null && ((et.isHiphen() || et.isChar('_') || et.isValue("НЕТ", null))) && drob) 
                    t1 = et;
                com.pullenti.ner.Token ett = et;
                if ((ett != null && ett.isCharOf(",.") && (ett.getWhitespacesAfterCount() < 2)) && (ett.getNext() instanceof com.pullenti.ner.TextToken)) {
                    if (com.pullenti.ner.core.BracketHelper.isBracket(ett.getNext(), false)) 
                        ett = ett.getNext();
                    else if (ett.getNext().getLengthChar() == 1 && ett.getNext().chars.isLetter() && ((ett.getNext().getNext() == null || ett.getNext().getNext().isComma()))) {
                        String ch = correctCharToken(ett.getNext());
                        if (ch != null) {
                            num.append(ch);
                            ett = ett.getNext();
                            t1 = ett;
                        }
                    }
                }
                if ((com.pullenti.ner.core.BracketHelper.isBracket(ett, false) && (ett.getNext() instanceof com.pullenti.ner.TextToken) && ett.getNext().getLengthChar() == 1) && ett.getNext().isLetters() && com.pullenti.ner.core.BracketHelper.isBracket(ett.getNext().getNext(), false)) {
                    String ch = correctCharToken(ett.getNext());
                    if (ch != null) {
                        num.append(ch);
                        t1 = ett.getNext().getNext();
                    }
                    else {
                        com.pullenti.ner.NumberToken ntt = com.pullenti.ner.core.NumberHelper.tryParseRoman(ett.getNext());
                        if (ntt != null) {
                            num.append("/").append(ntt.getValue());
                            t1 = ett.getNext().getNext();
                        }
                    }
                }
                else if (((com.pullenti.ner.core.BracketHelper.isBracket(ett, false) && com.pullenti.ner.core.BracketHelper.isBracket(ett.getNext(), false) && (ett.getNext().getNext() instanceof com.pullenti.ner.TextToken)) && ett.getNext().getNext().getLengthChar() == 1 && ett.getNext().getNext().isLetters()) && com.pullenti.ner.core.BracketHelper.isBracket(ett.getNext().getNext().getNext(), false)) {
                    String ch = correctCharToken(ett.getNext().getNext());
                    if (ch != null) {
                        num.append(ch);
                        t1 = ett.getNext().getNext().getNext();
                        while (t1.getNext() != null && com.pullenti.ner.core.BracketHelper.isBracket(t1.getNext(), false)) {
                            t1 = t1.getNext();
                        }
                    }
                }
                else if (com.pullenti.ner.core.BracketHelper.canBeStartOfSequence(ett, true, false) && (ett.getWhitespacesBeforeCount() < 2)) {
                    com.pullenti.ner.core.BracketSequenceToken br = com.pullenti.ner.core.BracketHelper.tryParse(ett, com.pullenti.ner.core.BracketParseAttr.NO, 100);
                    if (br != null && (br.getBeginToken().getNext() instanceof com.pullenti.ner.TextToken) && br.getBeginToken().getNext().getNext() == br.getEndToken()) {
                        String s = correctCharToken(br.getBeginToken().getNext());
                        if (s != null) {
                            num.append(s);
                            t1 = br.getEndToken();
                        }
                    }
                }
                else if ((et instanceof com.pullenti.ner.TextToken) && ((((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(et, com.pullenti.ner.TextToken.class)).getLengthChar() == 1 || ((et.getLengthChar() == 2 && et.chars.isAllUpper() && !et.isWhitespaceBefore())))) && et.chars.isLetter()) {
                    StreetItemToken ttt = StreetItemToken.tryParse(et, null, false, null);
                    String s = correctCharToken(et);
                    if (ttt != null && ((ttt.typ == StreetItemType.STDNAME || ttt.typ == StreetItemType.NOUN || ttt.typ == StreetItemType.FIX))) {
                        if (!et.isWhitespaceBefore() && et.getNext() != null && et.getNext().isCharOf("\\/")) {
                        }
                        else 
                            s = null;
                    }
                    else if (com.pullenti.ner.geo.internal.TerrItemToken.checkKeyword(et) != null) 
                        s = null;
                    if (et.isWhitespaceBefore()) {
                        AddressItemToken _next = tryParsePureItem(et, null, null);
                        if (_next != null && _next.value != null) 
                            s = null;
                        else if (et.getPrevious() != null && et.getPrevious().isHiphen() && et.getPrevious().isWhitespaceBefore()) 
                            s = null;
                    }
                    if (s != null) {
                        if (((com.pullenti.unisharp.Utils.stringsEq(s, "К") || com.pullenti.unisharp.Utils.stringsEq(s, "С"))) && (et.getNext() instanceof com.pullenti.ner.NumberToken) && !et.isWhitespaceAfter()) {
                        }
                        else if ((com.pullenti.unisharp.Utils.stringsEq(s, "Б") && et.getNext() != null && et.getNext().isCharOf("/\\")) && (et.getNext().getNext() instanceof com.pullenti.ner.TextToken) && et.getNext().getNext().isValue("Н", null)) 
                            t1 = (et = et.getNext().getNext());
                        else {
                            boolean ok = false;
                            if (drob || hiph || lit) 
                                ok = true;
                            else if (!et.isWhitespaceBefore() || ((et.getWhitespacesBeforeCount() == 1 && ((com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(et) || et.chars.isAllUpper() || ((et.isNewlineAfter() || ((et.getNext() != null && et.getNext().isComma()))))))))) {
                                ok = true;
                                if (et.getNext() instanceof com.pullenti.ner.NumberToken) {
                                    if (!et.isWhitespaceBefore() && ((et.isWhitespaceAfter() || (et.getNext() instanceof com.pullenti.ner.NumberToken)))) {
                                    }
                                    else 
                                        ok = false;
                                }
                                if (com.pullenti.unisharp.Utils.stringsEq(s, "К")) {
                                    if (t.getBeginChar() <= et.getPrevious().getBeginChar()) {
                                        AddressItemToken tmp = new AddressItemToken(_typ, t, et.getPrevious());
                                        AddressItemToken _next = tryParsePureItem(et, tmp, null);
                                        if (_next != null && _next.value != null) 
                                            ok = false;
                                    }
                                }
                                if (com.pullenti.unisharp.Utils.stringsEq(s, "И")) {
                                    AddressItemToken _next = tryParsePureItem(et.getNext(), prev, null);
                                    if (_next != null && _next.getTyp() == _typ) 
                                        ok = false;
                                }
                            }
                            else if (((et.getNext() == null || et.getNext().isComma())) && (((et.getWhitespacesBeforeCount() < 2) || com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(et)))) 
                                ok = true;
                            else if (et.isWhitespaceBefore() && et.chars.isAllLower() && et.isValue("В", "У")) {
                            }
                            else {
                                AddressItemToken aitNext = tryParsePureItem(et.getNext(), null, null);
                                if (aitNext != null) {
                                    if ((aitNext.getTyp() == AddressItemType.CORPUS || aitNext.getTyp() == AddressItemType.FLAT || aitNext.getTyp() == AddressItemType.BUILDING) || aitNext.getTyp() == AddressItemType.OFFICE || aitNext.getTyp() == AddressItemType.ROOM) 
                                        ok = true;
                                }
                            }
                            if (ok) {
                                num.append(s);
                                t1 = et;
                                if (et.getNext() != null && et.getNext().isCharOf("\\/") && et.getNext().getNext() != null) {
                                    com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(et.getNext().getNext(), com.pullenti.ner.geo.internal.GeoTokenType.STRONG);
                                    if (nn != null) {
                                        num.append("/").append(nn.value);
                                        t1 = (et = nn.getEndToken());
                                    }
                                    else if (et.getNext().getNext() instanceof com.pullenti.ner.NumberToken) {
                                        num.append("/").append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(et.getNext().getNext(), com.pullenti.ner.NumberToken.class)).getValue());
                                        t1 = (et = et.getNext().getNext());
                                    }
                                    else if (et.getNext().getNext().isHiphen() || et.getNext().getNext().isChar('_') || et.getNext().getNext().isValue("НЕТ", null)) 
                                        t1 = (et = et.getNext().getNext());
                                }
                                if ((et.getNext() instanceof com.pullenti.ner.NumberToken) && !et.isWhitespaceAfter()) {
                                    t1 = (et = et.getNext());
                                    num.append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class)).getValue());
                                }
                            }
                        }
                    }
                }
                else if ((et instanceof com.pullenti.ner.TextToken) && !et.isWhitespaceBefore()) {
                    String val = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(et, com.pullenti.ner.TextToken.class)).term;
                    if (com.pullenti.unisharp.Utils.stringsEq(val, "КМ") && _typ == AddressItemType.HOUSE) {
                        t1 = et;
                        num.append("КМ");
                    }
                    else if (com.pullenti.unisharp.Utils.stringsEq(val, "БН")) 
                        t1 = et;
                    else if (((val.length() == 2 && val.charAt(1) == 'Б' && et.getNext() != null) && et.getNext().isCharOf("\\/") && et.getNext().getNext() != null) && et.getNext().getNext().isValue("Н", null)) {
                        num.append(val.charAt(0));
                        t1 = (et = et.getNext().getNext());
                    }
                }
                if (!drob && t1.getNext() != null && t1.getNext().isCharOf("\\/")) {
                    AddressItemToken _next = _tryParsePureItem(t1.getNext().getNext(), false, null);
                    if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                        num.append("/").append(_next.value);
                        t1 = _next.getEndToken();
                    }
                }
            }
        }
        else if ((((re11 = _tryAttachVCH(t1, _typ)))) != null) {
            re11.setBeginToken(t);
            re11.houseType = houseTyp;
            re11.buildingType = buildTyp;
            return re11;
        }
        else if (((t1 instanceof com.pullenti.ner.TextToken) && t1.getLengthChar() == 2 && t1.isLetters()) && !t1.isWhitespaceBefore() && (t1.getPrevious() instanceof com.pullenti.ner.NumberToken)) {
            String src = t1.getSourceText();
            if ((src != null && src.length() == 2 && ((src.charAt(0) == 'к' || src.charAt(0) == 'k'))) && Character.isUpperCase(src.charAt(1))) {
                char ch = correctChar(src.charAt(1));
                if (ch != ((char)0)) 
                    return _new84(AddressItemType.CORPUS, t1, t1, (String.valueOf(ch)));
            }
        }
        else if ((t1 instanceof com.pullenti.ner.TextToken) && t1.getLengthChar() == 1 && t1.isLetters()) {
            if (t.isValue("САРАЙ", null)) 
                return null;
            String ch = correctCharToken(t1);
            if (com.pullenti.unisharp.Utils.stringsEq(ch, "З") && buildTyp != com.pullenti.ner.address.AddressBuildingType.LITER) 
                ch = "3";
            if (ch != null) {
                if (_typ == AddressItemType.NUMBER) 
                    return null;
                if (com.pullenti.unisharp.Utils.stringsEq(ch, "К") || com.pullenti.unisharp.Utils.stringsEq(ch, "С")) {
                    if (!t1.isWhitespaceAfter() && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) {
                        if ((buildTyp != com.pullenti.ner.address.AddressBuildingType.LITER && _typ != AddressItemType.HOUSE && _typ != AddressItemType.SPACE) && _typ != AddressItemType.CARPLACE && _typ != AddressItemType.BOX) 
                            return null;
                    }
                }
                if (com.pullenti.unisharp.Utils.stringsEq(ch, "С")) {
                    com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t1.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                    if (num1 != null && ((num1.hasPrefix || num1.isCadasterNumber))) 
                        return _new84(_typ, t, num1.getEndToken(), num1.value);
                }
                if (com.pullenti.unisharp.Utils.stringsEq(ch, "Д") && _typ == AddressItemType.PLOT) {
                    AddressItemToken rrr = tryParsePureItem(t1, null, null);
                    if (rrr != null) {
                        rrr.setTyp(AddressItemType.PLOT);
                        rrr.setBeginToken(t);
                        return rrr;
                    }
                }
                if (com.pullenti.unisharp.Utils.stringsEq(ch, "С") && t1.isWhitespaceAfter()) {
                    AddressItemToken _next = tryParsePureItem(t1.getNext(), null, null);
                    if (_next != null && _next.getTyp() == AddressItemType.NUMBER) {
                        AddressItemToken res1 = _new237(_typ, t, _next.getEndToken(), _next.value, t.getMorph(), houseTyp, buildTyp);
                        return res1;
                    }
                }
                if (prev != null && ((prev.getTyp() == AddressItemType.HOUSE || prev.getTyp() == AddressItemType.NUMBER || prev.getTyp() == AddressItemType.FLAT)) && com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t1)) {
                    if (_typ == AddressItemType.CORPUSORFLAT && prev.getTyp() == AddressItemType.HOUSE) 
                        _typ = AddressItemType.CORPUS;
                }
                else {
                    if (t1.chars.isAllLower() && ((t1.getMorph()._getClass().isPreposition() || t1.getMorph()._getClass().isConjunction()))) {
                        if ((t1.getWhitespacesAfterCount() < 2) && t1.getNext().chars.isLetter()) {
                            if (_typ == AddressItemType.HOUSE || _typ == AddressItemType.PLOT || _typ == AddressItemType.BOX) {
                                if (t.getBeginChar() <= t1.getPrevious().getBeginChar()) 
                                    return _new84(_typ, t, t1.getPrevious(), "0");
                            }
                            return null;
                        }
                    }
                    if ((t.chars.isAllUpper() && t.getLengthChar() == 1 && t.getNext().isChar('.')) && com.pullenti.unisharp.Utils.stringsNe(ch, "3")) 
                        return null;
                }
                num.append(ch);
                if ((t1.getNext() != null && ((t1.getNext().isHiphen() || t1.getNext().isChar('_'))) && !t1.isWhitespaceAfter()) && (t1.getNext().getNext() instanceof com.pullenti.ner.NumberToken) && !t1.getNext().isWhitespaceAfter()) {
                    com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(t1.getNext().getNext(), com.pullenti.ner.geo.internal.GeoTokenType.HOUSE);
                    if (nn != null) {
                        num.append(nn.value);
                        t1 = nn.getEndToken();
                    }
                    else {
                        num.append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1.getNext().getNext(), com.pullenti.ner.NumberToken.class)).getValue());
                        t1 = t1.getNext().getNext();
                    }
                }
                else if ((t1.getNext() instanceof com.pullenti.ner.NumberToken) && !t1.isWhitespaceAfter()) {
                    com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(t1.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.HOUSE);
                    if (nn != null) {
                        num.append(nn.value);
                        t1 = nn.getEndToken();
                    }
                    else {
                        num.append(((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1.getNext(), com.pullenti.ner.NumberToken.class)).getValue());
                        t1 = t1.getNext();
                    }
                }
                if (num.length() == 1 && ((_typ == AddressItemType.OFFICE || _typ == AddressItemType.ROOM))) {
                    if (!com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)) {
                        if (t.isValue("КОМ", null) && !t.getNext().isChar('.')) 
                            return null;
                    }
                }
            }
            if ((((_typ == AddressItemType.BOX || _typ == AddressItemType.SPACE || _typ == AddressItemType.PART) || _typ == AddressItemType.CARPLACE || _typ == AddressItemType.WELL)) && num.length() == 0) {
                com.pullenti.ner.NumberToken rom = com.pullenti.ner.core.NumberHelper.tryParseRoman(t1);
                if (rom != null) 
                    return _new84(_typ, t, rom.getEndToken(), rom.getValue().toString());
            }
        }
        else if (((com.pullenti.ner.core.BracketHelper.isBracket(t1, false) && (t1.getNext() instanceof com.pullenti.ner.TextToken) && t1.getNext().getLengthChar() == 1) && t1.getNext().isLetters() && com.pullenti.ner.core.BracketHelper.isBracket(t1.getNext().getNext(), false)) && !t1.isWhitespaceAfter() && !t1.getNext().isWhitespaceAfter()) {
            String ch = correctCharToken(t1.getNext());
            if (ch == null) 
                return null;
            num.append(ch);
            t1 = t1.getNext().getNext();
        }
        else if ((t1 instanceof com.pullenti.ner.TextToken) && ((((t1.getLengthChar() == 1 && ((t1.isHiphen() || t1.isChar('_'))))) || t1.isValue("НЕТ", null) || t1.isValue("БН", null))) && (((_typ == AddressItemType.CORPUS || _typ == AddressItemType.CORPUSORFLAT || _typ == AddressItemType.BUILDING) || _typ == AddressItemType.HOUSE || _typ == AddressItemType.FLAT))) {
            while (t1.getNext() != null && ((t1.getNext().isHiphen() || t1.getNext().isChar('_'))) && !t1.isWhitespaceAfter()) {
                t1 = t1.getNext();
            }
            String val = null;
            if (!t1.isWhitespaceAfter() && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) {
                t1 = t1.getNext();
                val = ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class)).getValue().toString();
            }
            if (t1.isValue("БН", null)) 
                val = "0";
            else if (t1.isValue("НЕТ", null)) 
                val = "НЕТ";
            return _new84(_typ, t, t1, val);
        }
        else {
            if (((_typ == AddressItemType.FLOOR || _typ == AddressItemType.KILOMETER || _typ == AddressItemType.POTCH)) && (t.getPrevious() instanceof com.pullenti.ner.NumberToken)) 
                return new AddressItemToken(_typ, t, t1.getPrevious());
            if ((t1 instanceof com.pullenti.ner.ReferentToken) && (t1.getReferent() instanceof com.pullenti.ner.date.DateReferent)) {
                AddressItemToken nn = tryParsePureItem(((com.pullenti.ner.ReferentToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.ReferentToken.class)).getBeginToken(), null, null);
                if (nn != null && nn.getEndChar() == t1.getEndChar() && nn.getTyp() == AddressItemType.NUMBER) {
                    nn.setBeginToken(t);
                    nn.setEndToken(t1);
                    nn.setTyp(_typ);
                    return nn;
                }
            }
            if ((t1 instanceof com.pullenti.ner.TextToken) && ((_typ == AddressItemType.HOUSE || _typ == AddressItemType.BUILDING || _typ == AddressItemType.CORPUS))) {
                String ter = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term;
                if (com.pullenti.unisharp.Utils.stringsEq(ter, "АБ") || com.pullenti.unisharp.Utils.stringsEq(ter, "АБВ") || com.pullenti.unisharp.Utils.stringsEq(ter, "МГУ")) 
                    return _new231(_typ, t, t1, ter, houseTyp, buildTyp);
                String ccc = _corrNumber(ter);
                if (ccc != null) 
                    return _new231(_typ, t, t1, ccc, houseTyp, buildTyp);
                if (t1.chars.isAllUpper()) {
                    com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(t1, com.pullenti.ner.geo.internal.GeoTokenType.STRONG);
                    if (nn != null && nn.getEndToken() != t1) {
                        t1 = nn.getEndToken();
                        ter = nn.value;
                    }
                    if (prev != null && ((prev.getTyp() == AddressItemType.STREET || prev.getTyp() == AddressItemType.CITY))) 
                        return _new231(_typ, t, t1, ter, houseTyp, buildTyp);
                    if (_typ == AddressItemType.CORPUS && (t1.getLengthChar() < 4)) 
                        return _new231(_typ, t, t1, ter, houseTyp, buildTyp);
                    if (_typ == AddressItemType.BUILDING && buildTyp == com.pullenti.ner.address.AddressBuildingType.LITER && (t1.getLengthChar() < 4)) 
                        return _new231(_typ, t, t1, ter, houseTyp, buildTyp);
                }
            }
            if ((_typ == AddressItemType.BOX || _typ == AddressItemType.SPACE || _typ == AddressItemType.PART) || _typ == AddressItemType.CARPLACE || _typ == AddressItemType.WELL) {
                com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t1, com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                if (num1 != null) 
                    return _new84(_typ, t, num1.getEndToken(), num1.value);
            }
            if (_typ == AddressItemType.PLOT && t1 != null) {
                if ((t1.isValue("ОКОЛО", null) || t1.isValue("РЯДОМ", null) || t1.isValue("НАПРОТИВ", null)) || t1.isValue("БЛИЗЬКО", null) || t1.isValue("НАВПАКИ", null)) 
                    return _new84(_typ, t, t1, t1.getSourceText().toLowerCase());
                AddressItemToken det = _tryAttachDetail(t1, null);
                if (det != null) {
                    if (t1.getPrevious() == null || (t1.getPrevious().getBeginChar() < t.getBeginChar())) 
                        return null;
                    return _new84(_typ, t, t1.getPrevious(), "0");
                }
            }
            if (((_typ != AddressItemType.NUMBER && (t1 instanceof com.pullenti.ner.TextToken) && t1.getLengthChar() <= 2) && t1.chars.isAllUpper() && t1.chars.isLetter()) && ((!t1.isWhitespaceAfter() || _typ == AddressItemType.PLOT || _typ == AddressItemType.BOX)) && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) {
                com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t1.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                if (num1 != null) 
                    return _new84(_typ, t, num1.getEndToken(), ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term + num1.value);
            }
            if (t1 != null && t1.isComma() && prev != null) {
                AddressItemToken _next = tryParsePureItem(t1.getNext(), null, null);
                if (_next != null) {
                    if (_next.getTyp() == AddressItemType.NUMBER || _next.getTyp() == _typ) 
                        return _new84(_typ, t, _next.getEndToken(), _next.value);
                    if (prev != null && t1.getPrevious() != null && t.getBeginChar() <= t1.getPrevious().getBeginChar()) 
                        return new AddressItemToken(_typ, t, t1.getPrevious());
                }
            }
            if (t1 != null && t1.isChar('(')) {
                AddressItemToken _next = tryParsePureItem(t1.getNext(), prev, null);
                if ((_next != null && _next.getTyp() == AddressItemType.NUMBER && _next.getEndToken().getNext() != null) && _next.getEndToken().getNext().isChar(')')) {
                    _next.setTyp(_typ);
                    _next.setBeginToken(t);
                    _next.setEndToken(_next.getEndToken().getNext());
                    return _next;
                }
            }
            if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t1) || _typ != AddressItemType.NUMBER) {
                com.pullenti.ner.NumberToken nt1 = com.pullenti.ner.core.NumberHelper.tryParseRoman(t1);
                if (nt1 != null) 
                    return _new84(_typ, t, t1, nt1.getValue());
            }
            if (com.pullenti.ner.core.BracketHelper.isBracket(t1, false) && (t1.getNext() instanceof com.pullenti.ner.NumberToken)) {
                AddressItemToken _next = _tryParsePureItem(t1.getNext(), false, prev);
                if ((_next != null && _next.getTyp() == AddressItemType.NUMBER && _next.getEndToken().getNext() != null) && com.pullenti.ner.core.BracketHelper.isBracket(_next.getEndToken().getNext(), false)) {
                    _next.setBeginToken(t);
                    _next.setTyp(_typ);
                    _next.setEndToken(_next.getEndToken().getNext());
                    return _next;
                }
            }
            if (_typ == AddressItemType.GENPLAN) 
                return _new84(_typ, t, tok00.getEndToken(), "0");
            if (_typ == AddressItemType.NUMBER && t.isValue("ОБЩЕЖИТИЕ", null)) {
                com.pullenti.ner.geo.internal.NumToken num1 = com.pullenti.ner.geo.internal.NumToken.tryParse(t.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                if (num1 != null) 
                    return _new84(AddressItemType.HOUSE, t, num1.getEndToken(), num1.value);
            }
            if (t.chars.isLatinLetter() && !t.kit.baseLanguage.isEn()) {
                com.pullenti.ner.NumberToken num2 = com.pullenti.ner.core.NumberHelper.tryParseRoman(t);
                if (num2 != null) 
                    return _new84(_typ, t, num2.getEndToken(), num2.getValue());
            }
            return null;
        }
        if (_typ == AddressItemType.NUMBER && prepos) 
            return null;
        if (t1 == null) {
            t1 = t;
            while (t1.getNext() != null) {
                t1 = t1.getNext();
            }
        }
        for (com.pullenti.ner.Token tt = t.getNext(); tt != null && tt.getEndChar() <= t1.getEndChar(); tt = tt.getNext()) {
            if (tt.isNewlineBefore() && !(tt instanceof com.pullenti.ner.NumberToken)) 
                return null;
        }
        if (num.length() == 0) {
            if (t1 != null && t1.chars.isLatinLetter() && ((!t1.kit.baseLanguage.isEn() || com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(t)))) {
                com.pullenti.ner.NumberToken num2 = com.pullenti.ner.core.NumberHelper.tryParseRoman(t1);
                if (num2 != null) 
                    return _new84(_typ, t, num2.getEndToken(), num2.getValue());
            }
            return null;
        }
        AddressItemToken res0 = _new256(_typ, t, t1, num.toString(), t.getMorph(), houseTyp, buildTyp, spaceDetail);
        t1 = t1.getNext();
        if (t1 != null && t1.isComma()) 
            t1 = t1.getNext();
        if ((t1 instanceof com.pullenti.ner.TextToken) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.startsWith("ОБ") && (t1.getWhitespacesBeforeCount() < 2)) {
            res0.setEndToken(t1);
            t1 = t1.getNext();
            if (t1 != null && t1.isChar('.')) {
                res0.setEndToken(t1);
                t1 = t1.getNext();
            }
            if (res0.getTyp() == AddressItemType.CORPUSORFLAT) 
                res0.setTyp(AddressItemType.FLAT);
        }
        if ((t1 != null && t1.isChar('(') && (t1.getNext() instanceof com.pullenti.ner.TextToken)) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1.getNext(), com.pullenti.ner.TextToken.class)).term.startsWith("ОБ")) {
            res0.setEndToken(t1.getNext());
            t1 = t1.getNext().getNext();
            while (t1 != null) {
                if (t1.isCharOf(".)")) {
                    res0.setEndToken(t1);
                    t1 = t1.getNext();
                }
                else 
                    break;
            }
            if (res0.getTyp() == AddressItemType.CORPUSORFLAT) 
                res0.setTyp(AddressItemType.FLAT);
        }
        if ((((t1 instanceof com.pullenti.ner.TextToken) && !t1.isWhitespaceBefore() && !t1.isWhitespaceAfter()) && (t1.getNext() instanceof com.pullenti.ner.NumberToken) && ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.length() == 2) && ((((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.charAt(1) == 'К' || ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.charAt(1) == 'K'))) {
            res0.value = (res0.value + ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term.charAt(0));
            res0.next = _new84(AddressItemType.CORPUS, t1, t1.getNext(), ((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1.getNext(), com.pullenti.ner.NumberToken.class)).getValue());
            res0.setEndToken(t1.getNext());
            if (res0.getTyp() == AddressItemType.NUMBER) 
                res0.setTyp(AddressItemType.HOUSE);
            return res0;
        }
        if ((_typ == AddressItemType.NUMBER && t1 != null && (t1.getWhitespacesBeforeCount() < 3)) && t1.isWhitespaceBefore()) {
            com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(t1, com.pullenti.ner.core.TerminParseAttr.NO);
            if (tok2 != null && !t1.getPrevious().isComma()) {
                AddressItemToken _next = _tryParsePureItem(t1, false, null);
                if ((_next != null && _next.getEndToken() == tok2.getEndToken() && _next.getTyp() != AddressItemType.NUMBER) && _next.buildingType != com.pullenti.ner.address.AddressBuildingType.LITER) {
                    if (((_next.getTyp() == AddressItemType.HOUSE || _next.getTyp() == AddressItemType.BUILDING || (_next.getTyp() == AddressItemType.CORPUS && _next.getTyp() == AddressItemType.FLOOR)) || _next.getTyp() == AddressItemType.FLAT || _next.getTyp() == AddressItemType.OFFICE) || _next.getTyp() == AddressItemType.PLOT) {
                        _next.value = res0.value;
                        _next.setBeginToken(t);
                        return _next;
                    }
                }
            }
        }
        if ((((res0.getTyp() == AddressItemType.SPACE || res0.getTyp() == AddressItemType.FLAT || res0.getTyp() == AddressItemType.OFFICE) || res0.getTyp() == AddressItemType.ROOM || ((res0.getTyp() == AddressItemType.NUMBER && hasNumPrefix)))) && res0.value != null) {
            int n0 = 0;
            com.pullenti.unisharp.Outargwrapper<Integer> wrapn0259 = new com.pullenti.unisharp.Outargwrapper<Integer>();
            com.pullenti.unisharp.Utils.parseInteger((res0.value != null ? res0.value : ""), 0, null, wrapn0259);
            n0 = (wrapn0259.value != null ? wrapn0259.value : 0);
            for (com.pullenti.ner.Token tt = res0.getEndToken().getNext(); tt != null; tt = tt.getNext()) {
                if (!tt.isCommaAnd() && !tt.isHiphen()) 
                    break;
                com.pullenti.ner.geo.internal.NumToken nn = com.pullenti.ner.geo.internal.NumToken.tryParse(tt.getNext(), com.pullenti.ner.geo.internal.GeoTokenType.ANY);
                if (nn == null) 
                    break;
                if (nn.value.length() == 6) 
                    break;
                if (nn.value.indexOf('-') > 0) {
                    nn.value = nn.value.substring(0, 0 + nn.value.indexOf('-'));
                    nn.setEndToken(nn.getBeginToken());
                }
                com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(nn.getEndToken().getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                if (tok2 != null) 
                    break;
                int n = 0;
                com.pullenti.unisharp.Outargwrapper<Integer> wrapn258 = new com.pullenti.unisharp.Outargwrapper<Integer>();
                com.pullenti.unisharp.Utils.parseInteger(nn.value, 0, null, wrapn258);
                n = (wrapn258.value != null ? wrapn258.value : 0);
                if (tt.isHiphen()) {
                    if (n > n0 && n0 > 0 && ((n - n0) < 100)) {
                        for (int k = n0 + 1; k <= n; k++) {
                            res0.value = (res0.value + "," + k);
                        }
                    }
                    else 
                        break;
                }
                else 
                    res0.value = (res0.value + "," + nn.value);
                res0.setEndToken(nn.getEndToken());
                if (tt.isAnd()) 
                    break;
                tt = nn.getEndToken();
                n0 = n;
            }
        }
        if (com.pullenti.ner.geo.internal.MiscLocationHelper.isUserParamAddress(res0)) {
            for (com.pullenti.ner.Token tt = res0.getEndToken().getNext(); tt != null; tt = tt.getNext()) {
                if (tt.isValue("СОГЛАСНО", null) || tt.isValue("ПО", null) || tt.getLengthChar() == 1) 
                    continue;
                if (tt.isValue("ПЛ", null) || tt.isValue("БТИ", null)) {
                    res0.setEndToken(tt);
                    continue;
                }
                com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.core.NounPhraseHelper.tryParse(tt, com.pullenti.ner.core.NounPhraseParseAttr.PARSEPREPOSITION, 0, null);
                if (npt == null) 
                    break;
                if ((npt.getEndToken().isValue("ПЛАН", null) || npt.getEndToken().isValue("ПРОЕКТ", null) || npt.getEndToken().isValue("КОПИЯ", null)) || npt.getEndToken().isValue("ПАСПОРТ", null)) {
                    res0.setEndToken((tt = npt.getEndToken()));
                    continue;
                }
                break;
            }
        }
        return res0;
    }

    private void _corrNum() {
        if (getEndToken().isChar(')')) 
            return;
        com.pullenti.ner.Token t1 = getEndToken().getNext();
        if (t1 != null && t1.isHiphen()) 
            t1 = t1.getNext();
        if (t1 == null) 
            return;
        if (((t1.isCharOf("\\/") || t1.isHiphen())) && t1.getNext() != null) 
            t1 = t1.getNext();
        if (getTyp() == AddressItemType.SPACE || getTyp() == AddressItemType.NUMBER) {
            com.pullenti.ner.core.TerminToken tok2 = m_Ontology.tryParse(t1, com.pullenti.ner.core.TerminParseAttr.NO);
            if (tok2 == null && t1 != null && t1.isChar('(')) {
                tok2 = m_Ontology.tryParse(t1.getNext(), com.pullenti.ner.core.TerminParseAttr.NO);
                if (tok2 != null && tok2.getEndToken().getNext() != null && tok2.getEndToken().getNext().isChar(')')) 
                    tok2.setEndToken(tok2.getEndToken().getNext());
                else 
                    tok2 = null;
            }
            if (tok2 != null && tok2.termin.tag != null && ((AddressItemType)tok2.termin.tag) == AddressItemType.SPACE) {
                setEndToken(tok2.getEndToken());
                setTyp(AddressItemType.SPACE);
                if (tok2.termin.tag2 != null && detailParam == null) {
                    detailParam = tok2.termin.getCanonicText();
                    if (detailParam.length() > 4) 
                        detailParam = detailParam.toLowerCase();
                }
                if (tok2.getBeginToken() != t1 && getEndToken().getNext() != null && getEndToken().getNext().isChar(')')) 
                    setEndToken(this.getEndToken().getNext());
                t1 = this.getEndToken().getNext();
            }
            if (t1 instanceof com.pullenti.ner.TextToken) {
                String vv = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term;
                if (com.pullenti.unisharp.Utils.stringsEq(vv, "НЧ") || com.pullenti.unisharp.Utils.stringsEq(vv, "Н") || com.pullenti.unisharp.Utils.stringsEq(vv, "H")) {
                    value += "Н";
                    setEndToken(t1);
                }
            }
            if (getTyp() == AddressItemType.SPACE && value != null && value.endsWith("Н")) {
                detailParam = "нежилое";
                value = value.substring(0, 0 + value.length() - 1);
                if (value.length() == 0) 
                    value = "0";
            }
        }
        else if ((getTyp() == AddressItemType.HOUSE || getTyp() == AddressItemType.BUILDING || getTyp() == AddressItemType.CORPUS) || getTyp() == AddressItemType.PLOT) {
            if (t1 instanceof com.pullenti.ner.TextToken) {
                String vv = ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.TextToken.class)).term;
                if (com.pullenti.unisharp.Utils.stringsEq(vv, "ОБЩ") || com.pullenti.unisharp.Utils.stringsEq(vv, "ГЛФ") || com.pullenti.unisharp.Utils.stringsEq(vv, "СХ")) 
                    setEndToken(t1);
            }
        }
    }

    private static AddressItemToken _tryAttachVCH(com.pullenti.ner.Token t, AddressItemType ty) {
        if (t == null) 
            return null;
        com.pullenti.ner.Token tt = t;
        if ((((tt.isValue("В", null) || tt.isValue("B", null))) && tt.getNext() != null && tt.getNext().isCharOf("./\\")) && (tt.getNext().getNext() instanceof com.pullenti.ner.TextToken) && tt.getNext().getNext().isValue("Ч", null)) {
            tt = tt.getNext().getNext();
            if (tt.getNext() != null && tt.getNext().isChar('.')) 
                tt = tt.getNext();
            com.pullenti.ner.Token tt2 = com.pullenti.ner.core.MiscHelper.checkNumberPrefix(tt.getNext());
            if (tt2 != null) 
                tt = tt2;
            if (tt.getNext() != null && (tt.getNext() instanceof com.pullenti.ner.NumberToken) && (tt.getWhitespacesAfterCount() < 2)) 
                tt = tt.getNext();
            return _new84(ty, t, tt, "В/Ч");
        }
        if (((tt.isValue("ВОЙСКОВОЙ", null) || tt.isValue("ВОИНСКИЙ", null))) && tt.getNext() != null && tt.getNext().isValue("ЧАСТЬ", null)) {
            tt = tt.getNext();
            com.pullenti.ner.Token tt2 = com.pullenti.ner.core.MiscHelper.checkNumberPrefix(tt.getNext());
            if (tt2 != null) 
                tt = tt2;
            if (tt.getNext() != null && (tt.getNext() instanceof com.pullenti.ner.NumberToken) && (tt.getWhitespacesAfterCount() < 2)) 
                tt = tt.getNext();
            return _new84(ty, t, tt, "В/Ч");
        }
        if (ty == AddressItemType.FLAT || ty == AddressItemType.SPACE) {
            if (tt.getWhitespacesBeforeCount() > 1) 
                return null;
            if (!(tt instanceof com.pullenti.ner.TextToken)) 
                return null;
            if (((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.startsWith("ОБЩ") || ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.startsWith("ВЕД") || ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term.startsWith("МОП")) {
                if (tt.getNext() != null && tt.getNext().isChar('.')) 
                    tt = tt.getNext();
                AddressItemToken re = _tryAttachVCH(tt.getNext(), ty);
                if (re != null) 
                    return re;
                return _new84(ty, t, tt, "0");
            }
            if (tt.chars.isAllUpper() && tt.getLengthChar() > 1) {
                if (com.pullenti.ner.core.NumberHelper.tryParseRoman(tt) == null) {
                    AddressItemToken re = _new84(ty, t, tt, ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term);
                    if ((tt.getWhitespacesAfterCount() < 2) && (tt.getNext() instanceof com.pullenti.ner.TextToken) && tt.getNext().chars.isAllUpper()) {
                        tt = tt.getNext();
                        re.setEndToken(tt);
                        re.value += ((com.pullenti.ner.TextToken)com.pullenti.unisharp.Utils.cast(tt, com.pullenti.ner.TextToken.class)).term;
                    }
                    return re;
                }
            }
        }
        return null;
    }

    private static String _outDoubeKm(com.pullenti.ner.NumberToken n1, com.pullenti.ner.NumberToken n2) {
        if (n1.getIntValue() == null || n2.getIntValue() == null) 
            return (n1.getValue() + "+" + n2.getValue());
        double v = n1.getRealValue() + ((n2.getRealValue() / (1000.0)));
        return com.pullenti.ner.core.NumberHelper.doubleToString(com.pullenti.unisharp.Utils.mathRound(v, 3));
    }

    private static AddressItemToken _tryAttachDetailRange(com.pullenti.ner.Token t) {
        com.pullenti.ner.Token t1 = t.getNext();
        if (t1 != null && t1.isChar('.')) 
            t1 = t1.getNext();
        if (!(t1 instanceof com.pullenti.ner.NumberToken)) 
            return null;
        if (t1.getNext() == null || !t1.getNext().isChar('+') || !(t1.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
            return null;
        AddressItemToken res = _new91(AddressItemType.DETAIL, t, t1.getNext().getNext(), com.pullenti.ner.address.AddressDetailType.RANGE);
        res.value = ("км" + _outDoubeKm((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class), (com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1.getNext().getNext(), com.pullenti.ner.NumberToken.class)));
        t1 = t1.getNext().getNext().getNext();
        if (t1 != null && t1.isHiphen()) 
            t1 = t1.getNext();
        if (t1 != null && t1.isValue("КМ", null)) {
            t1 = t1.getNext();
            if (t1 != null && t1.isChar('.')) 
                t1 = t1.getNext();
        }
        if (!(t1 instanceof com.pullenti.ner.NumberToken)) 
            return null;
        if (t1.getNext() == null || !t1.getNext().isChar('+') || !(t1.getNext().getNext() instanceof com.pullenti.ner.NumberToken)) 
            return null;
        res.value = (res.value + "-км" + _outDoubeKm((com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1, com.pullenti.ner.NumberToken.class), (com.pullenti.ner.NumberToken)com.pullenti.unisharp.Utils.cast(t1.getNext().getNext(), com.pullenti.ner.NumberToken.class)));
        res.setEndToken(t1.getNext().getNext());
        return res;
    }

    private static AddressItemToken _tryAttachDetail(com.pullenti.ner.Token t, com.pullenti.ner.core.TerminToken tok) {
        if (t == null || (t instanceof com.pullenti.ner.ReferentToken)) 
            return null;
        if (t.isValue("КМ", null)) {
            AddressItemToken ran = _tryAttachDetailRange(t);
            if (ran != null) 
                return ran;
        }
        com.pullenti.ner.Token tt = t;
        if (t.chars.isCapitalUpper() && !t.getMorph()._getClass().isPreposition()) 
            return null;
        if (tok == null) 
            tok = m_Ontology.tryParse(t, com.pullenti.ner.core.TerminParseAttr.NO);
        if (tok == null && t.getMorph()._getClass().isPreposition() && t.getNext() != null) {
            tt = t.getNext();
            if (tt instanceof com.pullenti.ner.NumberToken) {
            }
            else {
                if (tt.chars.isCapitalUpper() && !tt.getMorph()._getClass().isPreposition()) 
                    return null;
                tok = m_Ontology.tryParse(tt, com.pullenti.ner.core.TerminParseAttr.NO);
            }
        }
        AddressItemToken res = null;
        boolean firstNum = false;
        if (tok != null && tok.termin.tag2 != null && (tok.termin.tag instanceof com.pullenti.ner.address.AddressDetailType)) {
            res = new AddressItemToken(AddressItemType.DETAIL, t, tok.getEndToken());
            res.detailType = (com.pullenti.ner.address.AddressDetailType)tok.termin.tag;
            res.detailParam = "часть";
            return res;
        }
        if (tok == null) {
            com.pullenti.morph.MorphClass mc = tt.getMorphClassInDictionary();
            if (mc.isVerb()) {
                AddressItemToken _next = _tryAttachDetail(tt.getNext(), tok);
                if (_next != null) {
                    _next.setBeginToken(t);
                    return _next;
                }
            }
            if (tt instanceof com.pullenti.ner.NumberToken) {
                firstNum = true;
                com.pullenti.ner.core.NumberExToken nex = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(tt);
                if (nex != null && ((nex.exTyp == com.pullenti.ner.core.NumberExType.METER || nex.exTyp == com.pullenti.ner.core.NumberExType.KILOMETER))) {
                    res = new AddressItemToken(AddressItemType.DETAIL, t, nex.getEndToken());
                    com.pullenti.ner.core.NumberExType tyy = com.pullenti.ner.core.NumberExType.METER;
                    com.pullenti.unisharp.Outargwrapper<com.pullenti.ner.core.NumberExType> wraptyy265 = new com.pullenti.unisharp.Outargwrapper<com.pullenti.ner.core.NumberExType>(tyy);
                    res.detailMeters = (int)nex.normalizeValue(wraptyy265);
                    tyy = wraptyy265.value;
                    com.pullenti.ner.Token tt2 = res.getEndToken().getNext();
                    if (tt2 != null && tt2.isHiphen()) 
                        tt2 = tt2.getNext();
                    com.pullenti.ner.core.NumberExToken nex2 = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(tt2);
                    if (nex2 != null && nex2.exTyp == com.pullenti.ner.core.NumberExType.METER && nex2.getIntValue() != null) {
                        res.setEndToken(nex2.getEndToken());
                        res.detailMeters += nex2.getIntValue();
                    }
                }
            }
            if (res == null) 
                return null;
        }
        else {
            if (!(tok.termin.tag instanceof com.pullenti.ner.address.AddressDetailType)) 
                return null;
            if (t.isValue("У", null)) {
                if (t.getNext() == null || t.getNext().isCharOf(",.;")) 
                    return null;
            }
            res = _new91(AddressItemType.DETAIL, t, tok.getEndToken(), (com.pullenti.ner.address.AddressDetailType)tok.termin.tag);
        }
        for (tt = res.getEndToken().getNext(); tt != null; tt = tt.getNext()) {
            if (tt instanceof com.pullenti.ner.ReferentToken) 
                break;
            if (!tt.getMorph()._getClass().isPreposition()) {
                if (tt.chars.isCapitalUpper() || tt.chars.isAllUpper()) 
                    break;
            }
            tok = m_Ontology.tryParse(tt, com.pullenti.ner.core.TerminParseAttr.NO);
            if (tok != null && (tok.termin.tag instanceof com.pullenti.ner.address.AddressDetailType)) {
                com.pullenti.ner.address.AddressDetailType ty = (com.pullenti.ner.address.AddressDetailType)tok.termin.tag;
                if (ty != com.pullenti.ner.address.AddressDetailType.UNDEFINED) {
                    if (ty == com.pullenti.ner.address.AddressDetailType.NEAR && res.detailType != com.pullenti.ner.address.AddressDetailType.UNDEFINED && res.detailType != ty) {
                    }
                    else 
                        res.detailType = ty;
                }
                res.setEndToken((tt = tok.getEndToken()));
                continue;
            }
            com.pullenti.ner.core.NounPhraseToken npt = com.pullenti.ner.core.NounPhraseHelper.tryParse(tt, com.pullenti.ner.core.NounPhraseParseAttr.NO, 0, null);
            if (npt != null) 
                tt = npt.getEndToken();
            if (((tt.isValue("ОРИЕНТИР", null) || tt.isValue("НАПРАВЛЕНИЕ", null) || tt.isValue("ОТ", null)) || tt.isValue("В", null) || tt.isValue("УСАДЬБА", null)) || tt.isValue("ДВОР", null)) {
                res.setEndToken(tt);
                continue;
            }
            if (tt.isValue("ЗДАНИЕ", null) || tt.isValue("СТРОЕНИЕ", null) || tt.isValue("ДОМ", null)) {
                AddressItemToken ait = tryParsePureItem(tt, null, null);
                if (ait != null && ait.value != null) 
                    break;
                if (com.pullenti.ner.geo.internal.OrgItemToken.tryParse(tt.getNext(), null) != null) 
                    break;
                res.setEndToken(tt);
                continue;
            }
            if (npt != null && npt.internalNoun != null) {
                res.setEndToken((tt = npt.getEndToken()));
                continue;
            }
            if (((tt.isValue("ГРАНИЦА", null) || tt.isValue("ПРЕДЕЛ", null))) && tt.getNext() != null) {
                if (tt.getNext().isValue("УЧАСТОК", null)) {
                    tt = tt.getNext();
                    res.setEndToken(tt);
                    continue;
                }
            }
            com.pullenti.morph.MorphClass mc = tt.getMorphClassInDictionary();
            if (mc.isVerb() && !mc.isNoun()) 
                continue;
            if ((tt.isComma() || mc.isPreposition() || tt.isHiphen()) || tt.isChar(':')) 
                continue;
            if ((tt instanceof com.pullenti.ner.NumberToken) && tt.getNext() != null) {
                com.pullenti.ner.core.NumberExToken nex = com.pullenti.ner.core.NumberHelper.tryParseNumberWithPostfix(tt);
                if (nex != null && ((nex.exTyp == com.pullenti.ner.core.NumberExType.METER || nex.exTyp == com.pullenti.ner.core.NumberExType.KILOMETER))) {
                    res.setEndToken((tt = nex.getEndToken()));
                    com.pullenti.ner.core.NumberExType tyy = com.pullenti.ner.core.NumberExType.METER;
                    com.pullenti.unisharp.Outargwrapper<com.pullenti.ner.core.NumberExType> wraptyy267 = new com.pullenti.unisharp.Outargwrapper<com.pullenti.ner.core.NumberExType>(tyy);
                    res.detailMeters = (int)nex.normalizeValue(wraptyy267);
                    tyy = wraptyy267.value;
                    continue;
                }
            }
            break;
        }
        if (firstNum && res.detailType == com.pullenti.ner.address.AddressDetailType.UNDEFINED) 
            return null;
        if (res != null && res.getEndToken().getNext() != null && res.getEndToken().getNext().getMorph()._getClass().isPreposition()) {
            if (res.getEndToken().getWhitespacesAfterCount() == 1 && res.getEndToken().getNext().getWhitespacesAfterCount() == 1) 
                res.setEndToken(res.getEndToken().getNext());
        }
        if (res != null && res.getEndToken().getNext() != null) {
            if (res.getEndToken().getNext().isHiphen() || res.getEndToken().getNext().isChar(':')) 
                res.setEndToken(res.getEndToken().getNext());
        }
        return res;
    }

    public static AddressItemToken _new84(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        return res;
    }

    public static AddressItemToken _new85(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.Referent _arg4) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.referent = _arg4;
        return res;
    }

    public static AddressItemToken _new88(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.Referent _arg4, com.pullenti.ner.ReferentToken _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.referent = _arg4;
        res.refToken = _arg5;
        return res;
    }

    public static AddressItemToken _new91(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.address.AddressDetailType _arg4) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.detailType = _arg4;
        return res;
    }

    public static AddressItemToken _new211(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.address.AddressBuildingType _arg4, String _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.buildingType = _arg4;
        res.value = _arg5;
        return res;
    }

    public static AddressItemToken _new219(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.address.AddressHouseType _arg4, String _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.houseType = _arg4;
        res.value = _arg5;
        return res;
    }

    public static AddressItemToken _new222(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, com.pullenti.ner.ReferentToken _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.detailParam = _arg4;
        res.refToken2 = _arg5;
        return res;
    }

    public static AddressItemToken _new224(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, String _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.detailParam = _arg5;
        return res;
    }

    public static AddressItemToken _new225(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, com.pullenti.ner.address.AddressHouseType _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.houseType = _arg5;
        return res;
    }

    public static AddressItemToken _new227(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, boolean _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.isDoubt = _arg5;
        return res;
    }

    public static AddressItemToken _new228(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.address.AddressHouseType _arg4, com.pullenti.ner.address.AddressBuildingType _arg5, String _arg6, String _arg7) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.houseType = _arg4;
        res.buildingType = _arg5;
        res.value = _arg6;
        res.detailParam = _arg7;
        return res;
    }

    public static AddressItemToken _new231(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, com.pullenti.ner.address.AddressHouseType _arg5, com.pullenti.ner.address.AddressBuildingType _arg6) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.houseType = _arg5;
        res.buildingType = _arg6;
        return res;
    }

    public static AddressItemToken _new237(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, com.pullenti.ner.MorphCollection _arg5, com.pullenti.ner.address.AddressHouseType _arg6, com.pullenti.ner.address.AddressBuildingType _arg7) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.setMorph(_arg5);
        res.houseType = _arg6;
        res.buildingType = _arg7;
        return res;
    }

    public static AddressItemToken _new256(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, String _arg4, com.pullenti.ner.MorphCollection _arg5, com.pullenti.ner.address.AddressHouseType _arg6, com.pullenti.ner.address.AddressBuildingType _arg7, String _arg8) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.value = _arg4;
        res.setMorph(_arg5);
        res.houseType = _arg6;
        res.buildingType = _arg7;
        res.detailParam = _arg8;
        return res;
    }

    public static AddressItemToken _new270(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.Referent _arg4, boolean _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.referent = _arg4;
        res.isDoubt = _arg5;
        return res;
    }

    public static AddressItemToken _new290(AddressItemType _arg1, com.pullenti.ner.Token _arg2, com.pullenti.ner.Token _arg3, com.pullenti.ner.ReferentToken _arg4, com.pullenti.ner.address.AddressDetailType _arg5) {
        AddressItemToken res = new AddressItemToken(_arg1, _arg2, _arg3);
        res.refToken = _arg4;
        res.detailType = _arg5;
        return res;
    }
    public AddressItemToken() {
        super();
    }
}
