Commit 6c4c70b9 authored by Elizabeth Popova's avatar Elizabeth Popova Committed by Commit Bot

[Autofill] Adjust regexes for address components parsing (RU & BR)

- Add Russian keywords for street name and house number.
- Add additional Russian/Brazilian keywords for city.
- Adjust Brazilian street/addr1 keywords to exclude constructions like identificação do endereço, tipo de endereço, nome do endereço etc.
- Adjust Brazilian house number keyword to match labels with * (required) and "número da residência".

Change-Id: Ib48a921271cacbf30eae21e95d6c82dabe812218
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2468000Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarChristoph Schwering <schwering@google.com>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821134}
parent b3383cdc
......@@ -31,10 +31,16 @@ const char kCompanyRe[] =
"|شرکت" // fa
"|회사|직장"; // ko-KR
const char kStreetNameRe[] =
"stra(ss|ß)e" // de
"|street" // en
"|rua|avenida"; // br
const char kHouseNumberRe[] = "(house |^)number|(haus|^)nummer|^número$";
"stra(ss|ß)e" // de
"|street" // en
"|улица|название.?улицы" // ru
"|rua|avenida" // pt-PT, pt-BR
"|((?<!do |de )endereço)"; // pt-BR
const char kHouseNumberRe[] =
"(house.?|street.?|^)number" // en
"|(haus|^)nummer" // de
"|^\\*?.?número(.?\\*?$| da residência)" // pt-BR, pt-PT
"|дом|номер.?дома"; // ru
const char kAddressLine1Re[] =
"^address$|address[_-]?line(one)?|address1|addr1|street"
"|(?:shipping|billing)address$"
......@@ -44,7 +50,7 @@ const char kAddressLine1Re[] =
"|adresse" // fr-FR
"|indirizzo" // it-IT
"|^住所$|住所1" // ja-JP
"|morada|((?<!identificação do )endereço)" // pt-BR, pt-PT
"|morada|((?<!do |de )endereço)" // pt-BR, pt-PT
"|Адрес" // ru
"|地址" // zh-CN
"|(\\b|_)adres(?! (başlığı(nız)?|tarifi))(\\b|_)" // tr
......@@ -121,8 +127,8 @@ const char kCityRe[] =
"|ville|commune" // fr-FR
"|localita" // it-IT
"|市区町村" // ja-JP
"|cidade" // pt-BR, pt-PT
"|Город" // ru
"|cidade|município" // pt-BR, pt-PT
"|Город|Населённый.?пункт" // ru
"|市" // zh-CN
"|分區" // zh-TW
"|شهر" // fa
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="http://www.google.com/" method="post">
<label for="fn">Имя:</label> <input type="text" id="fn"><br>
<label for="ln">Фамилия:</label> <input type="text" id="ln"><br>
<label for="cm">Название компании:</label> <input type="text" id="cm"><br>
<label for="hn">Дом:</label> <input type="text" id="hn"><br>
<label for="sn">Улица:</label> <input type="text" id="sn"><br>
<label for="ct">Город:</label> <input type="text" id="ct"><br>
<label for="zc">Почтовый индекс:</label> <input type="text" id="zc"><br>
<label for="st">Область:</label> <input type="text" id="st"><br>
<label for="em">Адрес электронной почты:</label> <input type="text" id="em"><br>
<label for="ph">Телефон:</label> <input type="text" id="ph"><br>
<label for="c1">Имя владельца карты:</label> <input type="text" id="c1"><br>
<label for="c2">Номер кредитной карты:</label> <input type="text" id="c2"><br>
<label for="c3">Срок действия карты:</label> <input type="text" id="c3"><br>
<label for="c4">Срок действия карты:</label> <input type="text" id="c4"><br>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="http://www.google.com/" method="post">
<label for="fn">Имя:</label> <input type="text" id="fn"><br>
<label for="ln">Фамилия:</label> <input type="text" id="ln"><br>
<label for="cm">Название компании:</label> <input type="text" id="cm"><br>
<label for="sn">Название улицы:</label> <input type="text" id="sn"><br>
<label for="hn">Номер дома:</label> <input type="text" id="hn"><br>
<label for="ct">Населённый пункт:</label> <input type="text" id="ct"><br>
<label for="zc">Почтовый индекс:</label> <input type="text" id="zc"><br>
<label for="st">Область:</label> <input type="text" id="st"><br>
<label for="em">Адрес электронной почты:</label> <input type="text" id="em"><br>
<label for="ph">Телефон:</label> <input type="text" id="ph"><br>
<label for="c1">Имя владельца карты:</label> <input type="text" id="c1"><br>
<label for="c2">Номер кредитной карты:</label> <input type="text" id="c2"><br>
<label for="c3">Срок действия карты:</label> <input type="text" id="c3"><br>
<label for="c4">Срок действия карты:</label> <input type="text" id="c4"><br>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="http://www.google.com/" method="post">
<label for="fn">Nome:</label> <input type="text" id="fn"><br>
<label for="ln">Sobrenome:</label> <input type="text" id="ln"><br>
<label for="cm">Empresa:</label> <input type="text" id="cm"><br>
<label for="an">Identificação do endereço:</label> <input type="text" id="an"><br>
<label for="sn">Endereço:</label> <input type="text" id="sn"><br>
<label for="hn">*Número:</label> <input type="text" id="hn"><br>
<label for="ct">Cidade:</label> <input type="text" id="ct"><br>
<label for="zc">CEP:</label> <input type="text" id="zc"><br>
<label for="st">Estado:</label> <input type="text" id="st"><br>
<label for="em">Email:</label> <input type="text" id="em"><br>
<label for="ph">Telefone:</label> <input type="text" id="ph"><br>
<label for="c1">Nome do cartão:</label> <input type="text" id="c1"><br>
<label for="c2">Número do cartão:</label> <input type="text" id="c2"><br>
<label for="c3">Data de validade:</label> <input type="text" id="c3"><br>
<label for="c4">Data de validade:</label> <input type="text" id="c4"><br>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="http://www.google.com/" method="post">
<label for="fn">Nome:</label> <input type="text" id="fn"><br>
<label for="ln">Sobrenome:</label> <input type="text" id="ln"><br>
<label for="cm">Empresa:</label> <input type="text" id="cm"><br>
<label for="hn">Número da residência:</label> <input type="text" id="hn"><br>
<label for="sn">Endereço:</label> <input type="text" id="sn"><br>
<label for="ct">Município:</label> <input type="text" id="ct"><br>
<label for="zc">CEP:</label> <input type="text" id="zc"><br>
<label for="st">Estado:</label> <input type="text" id="st"><br>
<label for="em">Email:</label> <input type="text" id="em"><br>
<label for="ph">Telefone:</label> <input type="text" id="ph"><br>
<label for="c1">Nome do cartão:</label> <input type="text" id="c1"><br>
<label for="c2">Número do cartão:</label> <input type="text" id="c2"><br>
<label for="c3">Data de validade:</label> <input type="text" id="c3"><br>
<label for="c4">Data de validade:</label> <input type="text" id="c4"><br>
</form>
</body>
</html>
\ No newline at end of file
NAME_FIRST | fn | Имя: | | fn_1-default
NAME_LAST | ln | Фамилия: | | fn_1-default
COMPANY_NAME | cm | Название компании: | | fn_1-default
ADDRESS_HOME_HOUSE_NUMBER | hn | Дом: | | fn_1-default
ADDRESS_HOME_STREET_NAME | sn | Улица: | | fn_1-default
ADDRESS_HOME_CITY | ct | Город: | | fn_1-default
ADDRESS_HOME_ZIP | zc | Почтовый индекс: | | fn_1-default
ADDRESS_HOME_STATE | st | Область: | | fn_1-default
EMAIL_ADDRESS | em | Адрес электронной почты: | | fn_1-default
PHONE_HOME_WHOLE_NUMBER | ph | Телефон: | | fn_1-default
CREDIT_CARD_NAME_FULL | c1 | Имя владельца карты: | | credit-card-cc
CREDIT_CARD_NUMBER | c2 | Номер кредитной карты: | | credit-card-cc
CREDIT_CARD_EXP_MONTH | c3 | Срок действия карты: | | credit-card-cc
CREDIT_CARD_EXP_4_DIGIT_YEAR | c4 | Срок действия карты: | | credit-card-cc
NAME_FIRST | fn | Имя: | | fn_1-default
NAME_LAST | ln | Фамилия: | | fn_1-default
COMPANY_NAME | cm | Название компании: | | fn_1-default
ADDRESS_HOME_STREET_NAME | sn | Название улицы: | | fn_1-default
ADDRESS_HOME_HOUSE_NUMBER | hn | Номер дома: | | fn_1-default
ADDRESS_HOME_CITY | ct | Населённый пункт: | | fn_1-default
ADDRESS_HOME_ZIP | zc | Почтовый индекс: | | fn_1-default
ADDRESS_HOME_STATE | st | Область: | | fn_1-default
EMAIL_ADDRESS | em | Адрес электронной почты: | | fn_1-default
PHONE_HOME_WHOLE_NUMBER | ph | Телефон: | | fn_1-default
CREDIT_CARD_NAME_FULL | c1 | Имя владельца карты: | | credit-card-cc
CREDIT_CARD_NUMBER | c2 | Номер кредитной карты: | | credit-card-cc
CREDIT_CARD_EXP_MONTH | c3 | Срок действия карты: | | credit-card-cc
CREDIT_CARD_EXP_4_DIGIT_YEAR | c4 | Срок действия карты: | | credit-card-cc
NAME_FIRST | fn | Nome: | | fn_1-default
NAME_LAST | ln | Sobrenome: | | fn_1-default
COMPANY_NAME | cm | Empresa: | | fn_1-default
UNKNOWN_TYPE | an | Identificação do endereço: | | fn_1-default
ADDRESS_HOME_STREET_NAME | sn | Endereço: | | fn_1-default
ADDRESS_HOME_HOUSE_NUMBER | hn | *Número: | | fn_1-default
ADDRESS_HOME_CITY | ct | Cidade: | | fn_1-default
ADDRESS_HOME_ZIP | zc | CEP: | | fn_1-default
ADDRESS_HOME_STATE | st | Estado: | | fn_1-default
EMAIL_ADDRESS | em | Email: | | fn_1-default
PHONE_HOME_WHOLE_NUMBER | ph | Telefone: | | fn_1-default
CREDIT_CARD_NAME_FULL | c1 | Nome do cartão: | | credit-card-cc
CREDIT_CARD_NUMBER | c2 | Número do cartão: | | credit-card-cc
CREDIT_CARD_EXP_MONTH | c3 | Data de validade: | | credit-card-cc
CREDIT_CARD_EXP_4_DIGIT_YEAR | c4 | Data de validade: | | credit-card-cc
NAME_FIRST | fn | Nome: | | fn_1-default
NAME_LAST | ln | Sobrenome: | | fn_1-default
COMPANY_NAME | cm | Empresa: | | fn_1-default
ADDRESS_HOME_HOUSE_NUMBER | hn | Número da residência: | | fn_1-default
ADDRESS_HOME_STREET_NAME | sn | Endereço: | | fn_1-default
ADDRESS_HOME_CITY | ct | Município: | | fn_1-default
ADDRESS_HOME_ZIP | zc | CEP: | | fn_1-default
ADDRESS_HOME_STATE | st | Estado: | | fn_1-default
EMAIL_ADDRESS | em | Email: | | fn_1-default
PHONE_HOME_WHOLE_NUMBER | ph | Telefone: | | fn_1-default
CREDIT_CARD_NAME_FULL | c1 | Nome do cartão: | | credit-card-cc
CREDIT_CARD_NUMBER | c2 | Número do cartão: | | credit-card-cc
CREDIT_CARD_EXP_MONTH | c3 | Data de validade: | | credit-card-cc
CREDIT_CARD_EXP_4_DIGIT_YEAR | c4 | Data de validade: | | credit-card-cc
......@@ -359,6 +359,11 @@ bundle_data("unit_tests_bundle_data") {
"//components/test/data/autofill/heuristics/input/166_i18n_en_honorific_prefix.html",
"//components/test/data/autofill/heuristics/input/167_helity.es.html",
"//components/test/data/autofill/heuristics/input/168_i18n_hi.html",
"//components/test/data/autofill/heuristics/input/169_dominos_de.html",
"//components/test/data/autofill/heuristics/input/170_i18n_ru_structured_address_1.html",
"//components/test/data/autofill/heuristics/input/171_i18n_ru_structured_address_2.html",
"//components/test/data/autofill/heuristics/input/172_i18n_pt_structured_address_1.html",
"//components/test/data/autofill/heuristics/input/173_i18n_pt_structured_address_2.html",
"//components/test/data/autofill/heuristics/output/000_i18n_de.out",
"//components/test/data/autofill/heuristics/output/001_i18n_de2.out",
"//components/test/data/autofill/heuristics/output/002_i18n_en.out",
......@@ -527,6 +532,11 @@ bundle_data("unit_tests_bundle_data") {
"//components/test/data/autofill/heuristics/output/166_i18n_en_honorific_prefix.out",
"//components/test/data/autofill/heuristics/output/167_helity.es.out",
"//components/test/data/autofill/heuristics/output/168_i18n_hi.out",
"//components/test/data/autofill/heuristics/output/169_dominos_de.out",
"//components/test/data/autofill/heuristics/output/170_i18n_ru_structured_address_1.out",
"//components/test/data/autofill/heuristics/output/171_i18n_ru_structured_address_2.out",
"//components/test/data/autofill/heuristics/output/172_i18n_pt_structured_address_1.out",
"//components/test/data/autofill/heuristics/output/173_i18n_pt_structured_address_2.out",
]
outputs = [ "{{bundle_resources_dir}}/" +
"{{source_root_relative_dir}}/{{source_file_part}}" ]
......
......@@ -136,6 +136,8 @@ FormStructureBrowserTest::FormStructureBrowserTest()
{
// TODO(crbug.com/1098943): Remove once experiment is over.
autofill::features::kAutofillEnableSupportForMoreStructureInNames,
// TODO(crbug.com/1125978): Remove once launched.
autofill::features::kAutofillEnableSupportForMoreStructureInAddresses,
},
// Disabled
{autofill::features::kAutofillEnforceMinRequiredFieldsForHeuristics,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment