1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208
// This file is @generated by prost-build.
/// Represents the input to API methods.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Document {
/// Required. If the type is not set or is `TYPE_UNSPECIFIED`,
/// returns an `INVALID_ARGUMENT` error.
#[prost(enumeration = "document::Type", tag = "1")]
pub r#type: i32,
/// The language of the document (if not specified, the language is
/// automatically detected). Both ISO and BCP-47 language codes are
/// accepted.<br>
/// [Language
/// Support](<https://cloud.google.com/natural-language/docs/languages>) lists
/// currently supported languages for each API method. If the language (either
/// specified by the caller or automatically detected) is not supported by the
/// called API method, an `INVALID_ARGUMENT` error is returned.
#[prost(string, tag = "4")]
pub language: ::prost::alloc::string::String,
/// The web URI where the document comes from. This URI is not used for
/// fetching the content, but as a hint for analyzing the document.
#[prost(string, tag = "5")]
pub reference_web_uri: ::prost::alloc::string::String,
/// Indicates how detected boilerplate(e.g. advertisements, copyright
/// declarations, banners) should be handled for this document. If not
/// specified, boilerplate will be treated the same as content.
#[prost(enumeration = "document::BoilerplateHandling", tag = "6")]
pub boilerplate_handling: i32,
/// The source of the document: a string containing the content or a
/// Google Cloud Storage URI.
#[prost(oneof = "document::Source", tags = "2, 3")]
pub source: ::core::option::Option<document::Source>,
}
/// Nested message and enum types in `Document`.
pub mod document {
/// The document types enum.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// The content type is not specified.
Unspecified = 0,
/// Plain text
PlainText = 1,
/// HTML
Html = 2,
}
impl Type {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::PlainText => "PLAIN_TEXT",
Type::Html => "HTML",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"PLAIN_TEXT" => Some(Self::PlainText),
"HTML" => Some(Self::Html),
_ => None,
}
}
}
/// Ways of handling boilerplate detected in the document
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum BoilerplateHandling {
/// The boilerplate handling is not specified.
Unspecified = 0,
/// Do not analyze detected boilerplate. Reference web URI is required for
/// detecting boilerplate.
SkipBoilerplate = 1,
/// Treat boilerplate the same as content.
KeepBoilerplate = 2,
}
impl BoilerplateHandling {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
BoilerplateHandling::Unspecified => "BOILERPLATE_HANDLING_UNSPECIFIED",
BoilerplateHandling::SkipBoilerplate => "SKIP_BOILERPLATE",
BoilerplateHandling::KeepBoilerplate => "KEEP_BOILERPLATE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BOILERPLATE_HANDLING_UNSPECIFIED" => Some(Self::Unspecified),
"SKIP_BOILERPLATE" => Some(Self::SkipBoilerplate),
"KEEP_BOILERPLATE" => Some(Self::KeepBoilerplate),
_ => None,
}
}
}
/// The source of the document: a string containing the content or a
/// Google Cloud Storage URI.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
/// The content of the input in string format.
/// Cloud audit logging exempt since it is based on user data.
#[prost(string, tag = "2")]
Content(::prost::alloc::string::String),
/// The Google Cloud Storage URI where the file content is located.
/// This URI must be of the form: gs://bucket_name/object_name. For more
/// details, see <https://cloud.google.com/storage/docs/reference-uris.>
/// NOTE: Cloud Storage object versioning is not supported.
#[prost(string, tag = "3")]
GcsContentUri(::prost::alloc::string::String),
}
}
/// Represents a sentence in the input document.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Sentence {
/// The sentence text.
#[prost(message, optional, tag = "1")]
pub text: ::core::option::Option<TextSpan>,
/// For calls to [AnalyzeSentiment][] or if
/// [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment]
/// is set to true, this field will contain the sentiment for the sentence.
#[prost(message, optional, tag = "2")]
pub sentiment: ::core::option::Option<Sentiment>,
}
/// Represents a phrase in the text that is a known entity, such as
/// a person, an organization, or location. The API associates information, such
/// as salience and mentions, with entities.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entity {
/// The representative name for the entity.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The entity type.
#[prost(enumeration = "entity::Type", tag = "2")]
pub r#type: i32,
/// Metadata associated with the entity.
///
/// For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`)
/// and Knowledge Graph MID (`mid`), if they are available. For the metadata
/// associated with other entity types, see the Type table below.
#[prost(btree_map = "string, string", tag = "3")]
pub metadata: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// The salience score associated with the entity in the \[0, 1.0\] range.
///
/// The salience score for an entity provides information about the
/// importance or centrality of that entity to the entire document text.
/// Scores closer to 0 are less salient, while scores closer to 1.0 are highly
/// salient.
#[prost(float, tag = "4")]
pub salience: f32,
/// The mentions of this entity in the input document. The API currently
/// supports proper noun mentions.
#[prost(message, repeated, tag = "5")]
pub mentions: ::prost::alloc::vec::Vec<EntityMention>,
/// For calls to [AnalyzeEntitySentiment][] or if
/// [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment]
/// is set to true, this field will contain the aggregate sentiment expressed
/// for this entity in the provided document.
#[prost(message, optional, tag = "6")]
pub sentiment: ::core::option::Option<Sentiment>,
}
/// Nested message and enum types in `Entity`.
pub mod entity {
/// The type of the entity. For most entity types, the associated metadata is a
/// Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table
/// below lists the associated fields for entities that have different
/// metadata.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// Unknown
Unknown = 0,
/// Person
Person = 1,
/// Location
Location = 2,
/// Organization
Organization = 3,
/// Event
Event = 4,
/// Artwork
WorkOfArt = 5,
/// Consumer product
ConsumerGood = 6,
/// Other types of entities
Other = 7,
/// Phone number
///
/// The metadata lists the phone number, formatted according to local
/// convention, plus whichever additional elements appear in the text:
///
/// * `number` - the actual number, broken down into sections as per local
/// convention
/// * `national_prefix` - country code, if detected
/// * `area_code` - region or area code, if detected
/// * `extension` - phone extension (to be dialed after connection), if
/// detected
PhoneNumber = 9,
/// Address
///
/// The metadata identifies the street number and locality plus whichever
/// additional elements appear in the text:
///
/// * `street_number` - street number
/// * `locality` - city or town
/// * `street_name` - street/route name, if detected
/// * `postal_code` - postal code, if detected
/// * `country` - country, if detected<
/// * `broad_region` - administrative area, such as the state, if detected
/// * `narrow_region` - smaller administrative area, such as county, if
/// detected
/// * `sublocality` - used in Asian addresses to demark a district within a
/// city, if detected
Address = 10,
/// Date
///
/// The metadata identifies the components of the date:
///
/// * `year` - four digit year, if detected
/// * `month` - two digit month number, if detected
/// * `day` - two digit day number, if detected
Date = 11,
/// Number
///
/// The metadata is the number itself.
Number = 12,
/// Price
///
/// The metadata identifies the `value` and `currency`.
Price = 13,
}
impl Type {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unknown => "UNKNOWN",
Type::Person => "PERSON",
Type::Location => "LOCATION",
Type::Organization => "ORGANIZATION",
Type::Event => "EVENT",
Type::WorkOfArt => "WORK_OF_ART",
Type::ConsumerGood => "CONSUMER_GOOD",
Type::Other => "OTHER",
Type::PhoneNumber => "PHONE_NUMBER",
Type::Address => "ADDRESS",
Type::Date => "DATE",
Type::Number => "NUMBER",
Type::Price => "PRICE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"PERSON" => Some(Self::Person),
"LOCATION" => Some(Self::Location),
"ORGANIZATION" => Some(Self::Organization),
"EVENT" => Some(Self::Event),
"WORK_OF_ART" => Some(Self::WorkOfArt),
"CONSUMER_GOOD" => Some(Self::ConsumerGood),
"OTHER" => Some(Self::Other),
"PHONE_NUMBER" => Some(Self::PhoneNumber),
"ADDRESS" => Some(Self::Address),
"DATE" => Some(Self::Date),
"NUMBER" => Some(Self::Number),
"PRICE" => Some(Self::Price),
_ => None,
}
}
}
}
/// Represents the smallest syntactic building block of the text.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Token {
/// The token text.
#[prost(message, optional, tag = "1")]
pub text: ::core::option::Option<TextSpan>,
/// Parts of speech tag for this token.
#[prost(message, optional, tag = "2")]
pub part_of_speech: ::core::option::Option<PartOfSpeech>,
/// Dependency tree parse for this token.
#[prost(message, optional, tag = "3")]
pub dependency_edge: ::core::option::Option<DependencyEdge>,
/// [Lemma](<https://en.wikipedia.org/wiki/Lemma_%28morphology%29>) of the token.
#[prost(string, tag = "4")]
pub lemma: ::prost::alloc::string::String,
}
/// Represents the feeling associated with the entire text or entities in
/// the text.
/// Next ID: 6
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Sentiment {
/// A non-negative number in the [0, +inf) range, which represents
/// the absolute magnitude of sentiment regardless of score (positive or
/// negative).
#[prost(float, tag = "2")]
pub magnitude: f32,
/// Sentiment score between -1.0 (negative sentiment) and 1.0
/// (positive sentiment).
#[prost(float, tag = "3")]
pub score: f32,
}
/// Represents part of speech information for a token.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PartOfSpeech {
/// The part of speech tag.
#[prost(enumeration = "part_of_speech::Tag", tag = "1")]
pub tag: i32,
/// The grammatical aspect.
#[prost(enumeration = "part_of_speech::Aspect", tag = "2")]
pub aspect: i32,
/// The grammatical case.
#[prost(enumeration = "part_of_speech::Case", tag = "3")]
pub case: i32,
/// The grammatical form.
#[prost(enumeration = "part_of_speech::Form", tag = "4")]
pub form: i32,
/// The grammatical gender.
#[prost(enumeration = "part_of_speech::Gender", tag = "5")]
pub gender: i32,
/// The grammatical mood.
#[prost(enumeration = "part_of_speech::Mood", tag = "6")]
pub mood: i32,
/// The grammatical number.
#[prost(enumeration = "part_of_speech::Number", tag = "7")]
pub number: i32,
/// The grammatical person.
#[prost(enumeration = "part_of_speech::Person", tag = "8")]
pub person: i32,
/// The grammatical properness.
#[prost(enumeration = "part_of_speech::Proper", tag = "9")]
pub proper: i32,
/// The grammatical reciprocity.
#[prost(enumeration = "part_of_speech::Reciprocity", tag = "10")]
pub reciprocity: i32,
/// The grammatical tense.
#[prost(enumeration = "part_of_speech::Tense", tag = "11")]
pub tense: i32,
/// The grammatical voice.
#[prost(enumeration = "part_of_speech::Voice", tag = "12")]
pub voice: i32,
}
/// Nested message and enum types in `PartOfSpeech`.
pub mod part_of_speech {
/// The part of speech tags enum.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Tag {
/// Unknown
Unknown = 0,
/// Adjective
Adj = 1,
/// Adposition (preposition and postposition)
Adp = 2,
/// Adverb
Adv = 3,
/// Conjunction
Conj = 4,
/// Determiner
Det = 5,
/// Noun (common and proper)
Noun = 6,
/// Cardinal number
Num = 7,
/// Pronoun
Pron = 8,
/// Particle or other function word
Prt = 9,
/// Punctuation
Punct = 10,
/// Verb (all tenses and modes)
Verb = 11,
/// Other: foreign words, typos, abbreviations
X = 12,
/// Affix
Affix = 13,
}
impl Tag {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Tag::Unknown => "UNKNOWN",
Tag::Adj => "ADJ",
Tag::Adp => "ADP",
Tag::Adv => "ADV",
Tag::Conj => "CONJ",
Tag::Det => "DET",
Tag::Noun => "NOUN",
Tag::Num => "NUM",
Tag::Pron => "PRON",
Tag::Prt => "PRT",
Tag::Punct => "PUNCT",
Tag::Verb => "VERB",
Tag::X => "X",
Tag::Affix => "AFFIX",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ADJ" => Some(Self::Adj),
"ADP" => Some(Self::Adp),
"ADV" => Some(Self::Adv),
"CONJ" => Some(Self::Conj),
"DET" => Some(Self::Det),
"NOUN" => Some(Self::Noun),
"NUM" => Some(Self::Num),
"PRON" => Some(Self::Pron),
"PRT" => Some(Self::Prt),
"PUNCT" => Some(Self::Punct),
"VERB" => Some(Self::Verb),
"X" => Some(Self::X),
"AFFIX" => Some(Self::Affix),
_ => None,
}
}
}
/// The characteristic of a verb that expresses time flow during an event.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Aspect {
/// Aspect is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Perfective
Perfective = 1,
/// Imperfective
Imperfective = 2,
/// Progressive
Progressive = 3,
}
impl Aspect {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Aspect::Unknown => "ASPECT_UNKNOWN",
Aspect::Perfective => "PERFECTIVE",
Aspect::Imperfective => "IMPERFECTIVE",
Aspect::Progressive => "PROGRESSIVE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ASPECT_UNKNOWN" => Some(Self::Unknown),
"PERFECTIVE" => Some(Self::Perfective),
"IMPERFECTIVE" => Some(Self::Imperfective),
"PROGRESSIVE" => Some(Self::Progressive),
_ => None,
}
}
}
/// The grammatical function performed by a noun or pronoun in a phrase,
/// clause, or sentence. In some languages, other parts of speech, such as
/// adjective and determiner, take case inflection in agreement with the noun.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Case {
/// Case is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Accusative
Accusative = 1,
/// Adverbial
Adverbial = 2,
/// Complementive
Complementive = 3,
/// Dative
Dative = 4,
/// Genitive
Genitive = 5,
/// Instrumental
Instrumental = 6,
/// Locative
Locative = 7,
/// Nominative
Nominative = 8,
/// Oblique
Oblique = 9,
/// Partitive
Partitive = 10,
/// Prepositional
Prepositional = 11,
/// Reflexive
ReflexiveCase = 12,
/// Relative
RelativeCase = 13,
/// Vocative
Vocative = 14,
}
impl Case {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Case::Unknown => "CASE_UNKNOWN",
Case::Accusative => "ACCUSATIVE",
Case::Adverbial => "ADVERBIAL",
Case::Complementive => "COMPLEMENTIVE",
Case::Dative => "DATIVE",
Case::Genitive => "GENITIVE",
Case::Instrumental => "INSTRUMENTAL",
Case::Locative => "LOCATIVE",
Case::Nominative => "NOMINATIVE",
Case::Oblique => "OBLIQUE",
Case::Partitive => "PARTITIVE",
Case::Prepositional => "PREPOSITIONAL",
Case::ReflexiveCase => "REFLEXIVE_CASE",
Case::RelativeCase => "RELATIVE_CASE",
Case::Vocative => "VOCATIVE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CASE_UNKNOWN" => Some(Self::Unknown),
"ACCUSATIVE" => Some(Self::Accusative),
"ADVERBIAL" => Some(Self::Adverbial),
"COMPLEMENTIVE" => Some(Self::Complementive),
"DATIVE" => Some(Self::Dative),
"GENITIVE" => Some(Self::Genitive),
"INSTRUMENTAL" => Some(Self::Instrumental),
"LOCATIVE" => Some(Self::Locative),
"NOMINATIVE" => Some(Self::Nominative),
"OBLIQUE" => Some(Self::Oblique),
"PARTITIVE" => Some(Self::Partitive),
"PREPOSITIONAL" => Some(Self::Prepositional),
"REFLEXIVE_CASE" => Some(Self::ReflexiveCase),
"RELATIVE_CASE" => Some(Self::RelativeCase),
"VOCATIVE" => Some(Self::Vocative),
_ => None,
}
}
}
/// Depending on the language, Form can be categorizing different forms of
/// verbs, adjectives, adverbs, etc. For example, categorizing inflected
/// endings of verbs and adjectives or distinguishing between short and long
/// forms of adjectives and participles
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Form {
/// Form is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Adnomial
Adnomial = 1,
/// Auxiliary
Auxiliary = 2,
/// Complementizer
Complementizer = 3,
/// Final ending
FinalEnding = 4,
/// Gerund
Gerund = 5,
/// Realis
Realis = 6,
/// Irrealis
Irrealis = 7,
/// Short form
Short = 8,
/// Long form
Long = 9,
/// Order form
Order = 10,
/// Specific form
Specific = 11,
}
impl Form {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Form::Unknown => "FORM_UNKNOWN",
Form::Adnomial => "ADNOMIAL",
Form::Auxiliary => "AUXILIARY",
Form::Complementizer => "COMPLEMENTIZER",
Form::FinalEnding => "FINAL_ENDING",
Form::Gerund => "GERUND",
Form::Realis => "REALIS",
Form::Irrealis => "IRREALIS",
Form::Short => "SHORT",
Form::Long => "LONG",
Form::Order => "ORDER",
Form::Specific => "SPECIFIC",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"FORM_UNKNOWN" => Some(Self::Unknown),
"ADNOMIAL" => Some(Self::Adnomial),
"AUXILIARY" => Some(Self::Auxiliary),
"COMPLEMENTIZER" => Some(Self::Complementizer),
"FINAL_ENDING" => Some(Self::FinalEnding),
"GERUND" => Some(Self::Gerund),
"REALIS" => Some(Self::Realis),
"IRREALIS" => Some(Self::Irrealis),
"SHORT" => Some(Self::Short),
"LONG" => Some(Self::Long),
"ORDER" => Some(Self::Order),
"SPECIFIC" => Some(Self::Specific),
_ => None,
}
}
}
/// Gender classes of nouns reflected in the behaviour of associated words.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Gender {
/// Gender is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Feminine
Feminine = 1,
/// Masculine
Masculine = 2,
/// Neuter
Neuter = 3,
}
impl Gender {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Gender::Unknown => "GENDER_UNKNOWN",
Gender::Feminine => "FEMININE",
Gender::Masculine => "MASCULINE",
Gender::Neuter => "NEUTER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GENDER_UNKNOWN" => Some(Self::Unknown),
"FEMININE" => Some(Self::Feminine),
"MASCULINE" => Some(Self::Masculine),
"NEUTER" => Some(Self::Neuter),
_ => None,
}
}
}
/// The grammatical feature of verbs, used for showing modality and attitude.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Mood {
/// Mood is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Conditional
ConditionalMood = 1,
/// Imperative
Imperative = 2,
/// Indicative
Indicative = 3,
/// Interrogative
Interrogative = 4,
/// Jussive
Jussive = 5,
/// Subjunctive
Subjunctive = 6,
}
impl Mood {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Mood::Unknown => "MOOD_UNKNOWN",
Mood::ConditionalMood => "CONDITIONAL_MOOD",
Mood::Imperative => "IMPERATIVE",
Mood::Indicative => "INDICATIVE",
Mood::Interrogative => "INTERROGATIVE",
Mood::Jussive => "JUSSIVE",
Mood::Subjunctive => "SUBJUNCTIVE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MOOD_UNKNOWN" => Some(Self::Unknown),
"CONDITIONAL_MOOD" => Some(Self::ConditionalMood),
"IMPERATIVE" => Some(Self::Imperative),
"INDICATIVE" => Some(Self::Indicative),
"INTERROGATIVE" => Some(Self::Interrogative),
"JUSSIVE" => Some(Self::Jussive),
"SUBJUNCTIVE" => Some(Self::Subjunctive),
_ => None,
}
}
}
/// Count distinctions.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Number {
/// Number is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Singular
Singular = 1,
/// Plural
Plural = 2,
/// Dual
Dual = 3,
}
impl Number {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Number::Unknown => "NUMBER_UNKNOWN",
Number::Singular => "SINGULAR",
Number::Plural => "PLURAL",
Number::Dual => "DUAL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NUMBER_UNKNOWN" => Some(Self::Unknown),
"SINGULAR" => Some(Self::Singular),
"PLURAL" => Some(Self::Plural),
"DUAL" => Some(Self::Dual),
_ => None,
}
}
}
/// The distinction between the speaker, second person, third person, etc.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Person {
/// Person is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// First
First = 1,
/// Second
Second = 2,
/// Third
Third = 3,
/// Reflexive
ReflexivePerson = 4,
}
impl Person {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Person::Unknown => "PERSON_UNKNOWN",
Person::First => "FIRST",
Person::Second => "SECOND",
Person::Third => "THIRD",
Person::ReflexivePerson => "REFLEXIVE_PERSON",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PERSON_UNKNOWN" => Some(Self::Unknown),
"FIRST" => Some(Self::First),
"SECOND" => Some(Self::Second),
"THIRD" => Some(Self::Third),
"REFLEXIVE_PERSON" => Some(Self::ReflexivePerson),
_ => None,
}
}
}
/// This category shows if the token is part of a proper name.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Proper {
/// Proper is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Proper
Proper = 1,
/// Not proper
NotProper = 2,
}
impl Proper {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Proper::Unknown => "PROPER_UNKNOWN",
Proper::Proper => "PROPER",
Proper::NotProper => "NOT_PROPER",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"PROPER_UNKNOWN" => Some(Self::Unknown),
"PROPER" => Some(Self::Proper),
"NOT_PROPER" => Some(Self::NotProper),
_ => None,
}
}
}
/// Reciprocal features of a pronoun.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Reciprocity {
/// Reciprocity is not applicable in the analyzed language or is not
/// predicted.
Unknown = 0,
/// Reciprocal
Reciprocal = 1,
/// Non-reciprocal
NonReciprocal = 2,
}
impl Reciprocity {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Reciprocity::Unknown => "RECIPROCITY_UNKNOWN",
Reciprocity::Reciprocal => "RECIPROCAL",
Reciprocity::NonReciprocal => "NON_RECIPROCAL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RECIPROCITY_UNKNOWN" => Some(Self::Unknown),
"RECIPROCAL" => Some(Self::Reciprocal),
"NON_RECIPROCAL" => Some(Self::NonReciprocal),
_ => None,
}
}
}
/// Time reference.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Tense {
/// Tense is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Conditional
ConditionalTense = 1,
/// Future
Future = 2,
/// Past
Past = 3,
/// Present
Present = 4,
/// Imperfect
Imperfect = 5,
/// Pluperfect
Pluperfect = 6,
}
impl Tense {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Tense::Unknown => "TENSE_UNKNOWN",
Tense::ConditionalTense => "CONDITIONAL_TENSE",
Tense::Future => "FUTURE",
Tense::Past => "PAST",
Tense::Present => "PRESENT",
Tense::Imperfect => "IMPERFECT",
Tense::Pluperfect => "PLUPERFECT",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TENSE_UNKNOWN" => Some(Self::Unknown),
"CONDITIONAL_TENSE" => Some(Self::ConditionalTense),
"FUTURE" => Some(Self::Future),
"PAST" => Some(Self::Past),
"PRESENT" => Some(Self::Present),
"IMPERFECT" => Some(Self::Imperfect),
"PLUPERFECT" => Some(Self::Pluperfect),
_ => None,
}
}
}
/// The relationship between the action that a verb expresses and the
/// participants identified by its arguments.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Voice {
/// Voice is not applicable in the analyzed language or is not predicted.
Unknown = 0,
/// Active
Active = 1,
/// Causative
Causative = 2,
/// Passive
Passive = 3,
}
impl Voice {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Voice::Unknown => "VOICE_UNKNOWN",
Voice::Active => "ACTIVE",
Voice::Causative => "CAUSATIVE",
Voice::Passive => "PASSIVE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"VOICE_UNKNOWN" => Some(Self::Unknown),
"ACTIVE" => Some(Self::Active),
"CAUSATIVE" => Some(Self::Causative),
"PASSIVE" => Some(Self::Passive),
_ => None,
}
}
}
}
/// Represents dependency parse tree information for a token.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DependencyEdge {
/// Represents the head of this token in the dependency tree.
/// This is the index of the token which has an arc going to this token.
/// The index is the position of the token in the array of tokens returned
/// by the API method. If this token is a root token, then the
/// `head_token_index` is its own index.
#[prost(int32, tag = "1")]
pub head_token_index: i32,
/// The parse label for the token.
#[prost(enumeration = "dependency_edge::Label", tag = "2")]
pub label: i32,
}
/// Nested message and enum types in `DependencyEdge`.
pub mod dependency_edge {
/// The parse label enum for the token.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Label {
/// Unknown
Unknown = 0,
/// Abbreviation modifier
Abbrev = 1,
/// Adjectival complement
Acomp = 2,
/// Adverbial clause modifier
Advcl = 3,
/// Adverbial modifier
Advmod = 4,
/// Adjectival modifier of an NP
Amod = 5,
/// Appositional modifier of an NP
Appos = 6,
/// Attribute dependent of a copular verb
Attr = 7,
/// Auxiliary (non-main) verb
Aux = 8,
/// Passive auxiliary
Auxpass = 9,
/// Coordinating conjunction
Cc = 10,
/// Clausal complement of a verb or adjective
Ccomp = 11,
/// Conjunct
Conj = 12,
/// Clausal subject
Csubj = 13,
/// Clausal passive subject
Csubjpass = 14,
/// Dependency (unable to determine)
Dep = 15,
/// Determiner
Det = 16,
/// Discourse
Discourse = 17,
/// Direct object
Dobj = 18,
/// Expletive
Expl = 19,
/// Goes with (part of a word in a text not well edited)
Goeswith = 20,
/// Indirect object
Iobj = 21,
/// Marker (word introducing a subordinate clause)
Mark = 22,
/// Multi-word expression
Mwe = 23,
/// Multi-word verbal expression
Mwv = 24,
/// Negation modifier
Neg = 25,
/// Noun compound modifier
Nn = 26,
/// Noun phrase used as an adverbial modifier
Npadvmod = 27,
/// Nominal subject
Nsubj = 28,
/// Passive nominal subject
Nsubjpass = 29,
/// Numeric modifier of a noun
Num = 30,
/// Element of compound number
Number = 31,
/// Punctuation mark
P = 32,
/// Parataxis relation
Parataxis = 33,
/// Participial modifier
Partmod = 34,
/// The complement of a preposition is a clause
Pcomp = 35,
/// Object of a preposition
Pobj = 36,
/// Possession modifier
Poss = 37,
/// Postverbal negative particle
Postneg = 38,
/// Predicate complement
Precomp = 39,
/// Preconjunt
Preconj = 40,
/// Predeterminer
Predet = 41,
/// Prefix
Pref = 42,
/// Prepositional modifier
Prep = 43,
/// The relationship between a verb and verbal morpheme
Pronl = 44,
/// Particle
Prt = 45,
/// Associative or possessive marker
Ps = 46,
/// Quantifier phrase modifier
Quantmod = 47,
/// Relative clause modifier
Rcmod = 48,
/// Complementizer in relative clause
Rcmodrel = 49,
/// Ellipsis without a preceding predicate
Rdrop = 50,
/// Referent
Ref = 51,
/// Remnant
Remnant = 52,
/// Reparandum
Reparandum = 53,
/// Root
Root = 54,
/// Suffix specifying a unit of number
Snum = 55,
/// Suffix
Suff = 56,
/// Temporal modifier
Tmod = 57,
/// Topic marker
Topic = 58,
/// Clause headed by an infinite form of the verb that modifies a noun
Vmod = 59,
/// Vocative
Vocative = 60,
/// Open clausal complement
Xcomp = 61,
/// Name suffix
Suffix = 62,
/// Name title
Title = 63,
/// Adverbial phrase modifier
Advphmod = 64,
/// Causative auxiliary
Auxcaus = 65,
/// Helper auxiliary
Auxvv = 66,
/// Rentaishi (Prenominal modifier)
Dtmod = 67,
/// Foreign words
Foreign = 68,
/// Keyword
Kw = 69,
/// List for chains of comparable items
List = 70,
/// Nominalized clause
Nomc = 71,
/// Nominalized clausal subject
Nomcsubj = 72,
/// Nominalized clausal passive
Nomcsubjpass = 73,
/// Compound of numeric modifier
Numc = 74,
/// Copula
Cop = 75,
/// Dislocated relation (for fronted/topicalized elements)
Dislocated = 76,
/// Aspect marker
Asp = 77,
/// Genitive modifier
Gmod = 78,
/// Genitive object
Gobj = 79,
/// Infinitival modifier
Infmod = 80,
/// Measure
Mes = 81,
/// Nominal complement of a noun
Ncomp = 82,
}
impl Label {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Label::Unknown => "UNKNOWN",
Label::Abbrev => "ABBREV",
Label::Acomp => "ACOMP",
Label::Advcl => "ADVCL",
Label::Advmod => "ADVMOD",
Label::Amod => "AMOD",
Label::Appos => "APPOS",
Label::Attr => "ATTR",
Label::Aux => "AUX",
Label::Auxpass => "AUXPASS",
Label::Cc => "CC",
Label::Ccomp => "CCOMP",
Label::Conj => "CONJ",
Label::Csubj => "CSUBJ",
Label::Csubjpass => "CSUBJPASS",
Label::Dep => "DEP",
Label::Det => "DET",
Label::Discourse => "DISCOURSE",
Label::Dobj => "DOBJ",
Label::Expl => "EXPL",
Label::Goeswith => "GOESWITH",
Label::Iobj => "IOBJ",
Label::Mark => "MARK",
Label::Mwe => "MWE",
Label::Mwv => "MWV",
Label::Neg => "NEG",
Label::Nn => "NN",
Label::Npadvmod => "NPADVMOD",
Label::Nsubj => "NSUBJ",
Label::Nsubjpass => "NSUBJPASS",
Label::Num => "NUM",
Label::Number => "NUMBER",
Label::P => "P",
Label::Parataxis => "PARATAXIS",
Label::Partmod => "PARTMOD",
Label::Pcomp => "PCOMP",
Label::Pobj => "POBJ",
Label::Poss => "POSS",
Label::Postneg => "POSTNEG",
Label::Precomp => "PRECOMP",
Label::Preconj => "PRECONJ",
Label::Predet => "PREDET",
Label::Pref => "PREF",
Label::Prep => "PREP",
Label::Pronl => "PRONL",
Label::Prt => "PRT",
Label::Ps => "PS",
Label::Quantmod => "QUANTMOD",
Label::Rcmod => "RCMOD",
Label::Rcmodrel => "RCMODREL",
Label::Rdrop => "RDROP",
Label::Ref => "REF",
Label::Remnant => "REMNANT",
Label::Reparandum => "REPARANDUM",
Label::Root => "ROOT",
Label::Snum => "SNUM",
Label::Suff => "SUFF",
Label::Tmod => "TMOD",
Label::Topic => "TOPIC",
Label::Vmod => "VMOD",
Label::Vocative => "VOCATIVE",
Label::Xcomp => "XCOMP",
Label::Suffix => "SUFFIX",
Label::Title => "TITLE",
Label::Advphmod => "ADVPHMOD",
Label::Auxcaus => "AUXCAUS",
Label::Auxvv => "AUXVV",
Label::Dtmod => "DTMOD",
Label::Foreign => "FOREIGN",
Label::Kw => "KW",
Label::List => "LIST",
Label::Nomc => "NOMC",
Label::Nomcsubj => "NOMCSUBJ",
Label::Nomcsubjpass => "NOMCSUBJPASS",
Label::Numc => "NUMC",
Label::Cop => "COP",
Label::Dislocated => "DISLOCATED",
Label::Asp => "ASP",
Label::Gmod => "GMOD",
Label::Gobj => "GOBJ",
Label::Infmod => "INFMOD",
Label::Mes => "MES",
Label::Ncomp => "NCOMP",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"UNKNOWN" => Some(Self::Unknown),
"ABBREV" => Some(Self::Abbrev),
"ACOMP" => Some(Self::Acomp),
"ADVCL" => Some(Self::Advcl),
"ADVMOD" => Some(Self::Advmod),
"AMOD" => Some(Self::Amod),
"APPOS" => Some(Self::Appos),
"ATTR" => Some(Self::Attr),
"AUX" => Some(Self::Aux),
"AUXPASS" => Some(Self::Auxpass),
"CC" => Some(Self::Cc),
"CCOMP" => Some(Self::Ccomp),
"CONJ" => Some(Self::Conj),
"CSUBJ" => Some(Self::Csubj),
"CSUBJPASS" => Some(Self::Csubjpass),
"DEP" => Some(Self::Dep),
"DET" => Some(Self::Det),
"DISCOURSE" => Some(Self::Discourse),
"DOBJ" => Some(Self::Dobj),
"EXPL" => Some(Self::Expl),
"GOESWITH" => Some(Self::Goeswith),
"IOBJ" => Some(Self::Iobj),
"MARK" => Some(Self::Mark),
"MWE" => Some(Self::Mwe),
"MWV" => Some(Self::Mwv),
"NEG" => Some(Self::Neg),
"NN" => Some(Self::Nn),
"NPADVMOD" => Some(Self::Npadvmod),
"NSUBJ" => Some(Self::Nsubj),
"NSUBJPASS" => Some(Self::Nsubjpass),
"NUM" => Some(Self::Num),
"NUMBER" => Some(Self::Number),
"P" => Some(Self::P),
"PARATAXIS" => Some(Self::Parataxis),
"PARTMOD" => Some(Self::Partmod),
"PCOMP" => Some(Self::Pcomp),
"POBJ" => Some(Self::Pobj),
"POSS" => Some(Self::Poss),
"POSTNEG" => Some(Self::Postneg),
"PRECOMP" => Some(Self::Precomp),
"PRECONJ" => Some(Self::Preconj),
"PREDET" => Some(Self::Predet),
"PREF" => Some(Self::Pref),
"PREP" => Some(Self::Prep),
"PRONL" => Some(Self::Pronl),
"PRT" => Some(Self::Prt),
"PS" => Some(Self::Ps),
"QUANTMOD" => Some(Self::Quantmod),
"RCMOD" => Some(Self::Rcmod),
"RCMODREL" => Some(Self::Rcmodrel),
"RDROP" => Some(Self::Rdrop),
"REF" => Some(Self::Ref),
"REMNANT" => Some(Self::Remnant),
"REPARANDUM" => Some(Self::Reparandum),
"ROOT" => Some(Self::Root),
"SNUM" => Some(Self::Snum),
"SUFF" => Some(Self::Suff),
"TMOD" => Some(Self::Tmod),
"TOPIC" => Some(Self::Topic),
"VMOD" => Some(Self::Vmod),
"VOCATIVE" => Some(Self::Vocative),
"XCOMP" => Some(Self::Xcomp),
"SUFFIX" => Some(Self::Suffix),
"TITLE" => Some(Self::Title),
"ADVPHMOD" => Some(Self::Advphmod),
"AUXCAUS" => Some(Self::Auxcaus),
"AUXVV" => Some(Self::Auxvv),
"DTMOD" => Some(Self::Dtmod),
"FOREIGN" => Some(Self::Foreign),
"KW" => Some(Self::Kw),
"LIST" => Some(Self::List),
"NOMC" => Some(Self::Nomc),
"NOMCSUBJ" => Some(Self::Nomcsubj),
"NOMCSUBJPASS" => Some(Self::Nomcsubjpass),
"NUMC" => Some(Self::Numc),
"COP" => Some(Self::Cop),
"DISLOCATED" => Some(Self::Dislocated),
"ASP" => Some(Self::Asp),
"GMOD" => Some(Self::Gmod),
"GOBJ" => Some(Self::Gobj),
"INFMOD" => Some(Self::Infmod),
"MES" => Some(Self::Mes),
"NCOMP" => Some(Self::Ncomp),
_ => None,
}
}
}
}
/// Represents a mention for an entity in the text. Currently, proper noun
/// mentions are supported.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EntityMention {
/// The mention text.
#[prost(message, optional, tag = "1")]
pub text: ::core::option::Option<TextSpan>,
/// The type of the entity mention.
#[prost(enumeration = "entity_mention::Type", tag = "2")]
pub r#type: i32,
/// For calls to [AnalyzeEntitySentiment][] or if
/// [AnnotateTextRequest.Features.extract_entity_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entity_sentiment]
/// is set to true, this field will contain the sentiment expressed for this
/// mention of the entity in the provided document.
#[prost(message, optional, tag = "3")]
pub sentiment: ::core::option::Option<Sentiment>,
}
/// Nested message and enum types in `EntityMention`.
pub mod entity_mention {
/// The supported types of mentions.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
/// Unknown
Unknown = 0,
/// Proper name
Proper = 1,
/// Common noun (or noun compound)
Common = 2,
}
impl Type {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unknown => "TYPE_UNKNOWN",
Type::Proper => "PROPER",
Type::Common => "COMMON",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNKNOWN" => Some(Self::Unknown),
"PROPER" => Some(Self::Proper),
"COMMON" => Some(Self::Common),
_ => None,
}
}
}
}
/// Represents an output piece of text.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextSpan {
/// The content of the output text.
#[prost(string, tag = "1")]
pub content: ::prost::alloc::string::String,
/// The API calculates the beginning offset of the content in the original
/// document according to the
/// [EncodingType][google.cloud.language.v1beta2.EncodingType] specified in the
/// API request.
#[prost(int32, tag = "2")]
pub begin_offset: i32,
}
/// Represents a category returned from the text classifier.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassificationCategory {
/// The name of the category representing the document.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The classifier's confidence of the category. Number represents how certain
/// the classifier is that this category represents the given text.
#[prost(float, tag = "2")]
pub confidence: f32,
}
/// Model options available for classification requests.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClassificationModelOptions {
/// If this field is not set, then the `v1_model` will be used by default.
#[prost(oneof = "classification_model_options::ModelType", tags = "1, 2")]
pub model_type: ::core::option::Option<classification_model_options::ModelType>,
}
/// Nested message and enum types in `ClassificationModelOptions`.
pub mod classification_model_options {
/// Options for the V1 model.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct V1Model {}
/// Options for the V2 model.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct V2Model {
/// The content categories used for classification.
#[prost(enumeration = "v2_model::ContentCategoriesVersion", tag = "1")]
pub content_categories_version: i32,
}
/// Nested message and enum types in `V2Model`.
pub mod v2_model {
/// The content categories used for classification.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ContentCategoriesVersion {
/// If `ContentCategoriesVersion` is not specified, this option will
/// default to `V1`.
Unspecified = 0,
/// Legacy content categories of our initial launch in 2017.
V1 = 1,
/// Updated content categories in 2022.
V2 = 2,
}
impl ContentCategoriesVersion {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ContentCategoriesVersion::Unspecified => {
"CONTENT_CATEGORIES_VERSION_UNSPECIFIED"
}
ContentCategoriesVersion::V1 => "V1",
ContentCategoriesVersion::V2 => "V2",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CONTENT_CATEGORIES_VERSION_UNSPECIFIED" => Some(Self::Unspecified),
"V1" => Some(Self::V1),
"V2" => Some(Self::V2),
_ => None,
}
}
}
}
/// If this field is not set, then the `v1_model` will be used by default.
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum ModelType {
/// Setting this field will use the V1 model and V1 content categories
/// version. The V1 model is a legacy model; support for this will be
/// discontinued in the future.
#[prost(message, tag = "1")]
V1Model(V1Model),
/// Setting this field will use the V2 model with the appropriate content
/// categories version. The V2 model is a better performing model.
#[prost(message, tag = "2")]
V2Model(V2Model),
}
}
/// The sentiment analysis request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeSentimentRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// The encoding type used by the API to calculate sentence offsets for the
/// sentence sentiment.
#[prost(enumeration = "EncodingType", tag = "2")]
pub encoding_type: i32,
}
/// The sentiment analysis response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeSentimentResponse {
/// The overall sentiment of the input document.
#[prost(message, optional, tag = "1")]
pub document_sentiment: ::core::option::Option<Sentiment>,
/// The language of the text, which will be the same as the language specified
/// in the request or, if not specified, the automatically-detected language.
/// See [Document.language][google.cloud.language.v1beta2.Document.language]
/// field for more details.
#[prost(string, tag = "2")]
pub language: ::prost::alloc::string::String,
/// The sentiment for all the sentences in the document.
#[prost(message, repeated, tag = "3")]
pub sentences: ::prost::alloc::vec::Vec<Sentence>,
}
/// The entity-level sentiment analysis request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeEntitySentimentRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// The encoding type used by the API to calculate offsets.
#[prost(enumeration = "EncodingType", tag = "2")]
pub encoding_type: i32,
}
/// The entity-level sentiment analysis response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeEntitySentimentResponse {
/// The recognized entities in the input document with associated sentiments.
#[prost(message, repeated, tag = "1")]
pub entities: ::prost::alloc::vec::Vec<Entity>,
/// The language of the text, which will be the same as the language specified
/// in the request or, if not specified, the automatically-detected language.
/// See [Document.language][google.cloud.language.v1beta2.Document.language]
/// field for more details.
#[prost(string, tag = "2")]
pub language: ::prost::alloc::string::String,
}
/// The entity analysis request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeEntitiesRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// The encoding type used by the API to calculate offsets.
#[prost(enumeration = "EncodingType", tag = "2")]
pub encoding_type: i32,
}
/// The entity analysis response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeEntitiesResponse {
/// The recognized entities in the input document.
#[prost(message, repeated, tag = "1")]
pub entities: ::prost::alloc::vec::Vec<Entity>,
/// The language of the text, which will be the same as the language specified
/// in the request or, if not specified, the automatically-detected language.
/// See [Document.language][google.cloud.language.v1beta2.Document.language]
/// field for more details.
#[prost(string, tag = "2")]
pub language: ::prost::alloc::string::String,
}
/// The syntax analysis request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeSyntaxRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// The encoding type used by the API to calculate offsets.
#[prost(enumeration = "EncodingType", tag = "2")]
pub encoding_type: i32,
}
/// The syntax analysis response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeSyntaxResponse {
/// Sentences in the input document.
#[prost(message, repeated, tag = "1")]
pub sentences: ::prost::alloc::vec::Vec<Sentence>,
/// Tokens, along with their syntactic information, in the input document.
#[prost(message, repeated, tag = "2")]
pub tokens: ::prost::alloc::vec::Vec<Token>,
/// The language of the text, which will be the same as the language specified
/// in the request or, if not specified, the automatically-detected language.
/// See [Document.language][google.cloud.language.v1beta2.Document.language]
/// field for more details.
#[prost(string, tag = "3")]
pub language: ::prost::alloc::string::String,
}
/// The document classification request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassifyTextRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// Model options to use for classification. Defaults to v1 options if not
/// specified.
#[prost(message, optional, tag = "3")]
pub classification_model_options: ::core::option::Option<ClassificationModelOptions>,
}
/// The document classification response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassifyTextResponse {
/// Categories representing the input document.
#[prost(message, repeated, tag = "1")]
pub categories: ::prost::alloc::vec::Vec<ClassificationCategory>,
}
/// The document moderation request message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModerateTextRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
}
/// The document moderation response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModerateTextResponse {
/// Harmful and sensitive categories representing the input document.
#[prost(message, repeated, tag = "1")]
pub moderation_categories: ::prost::alloc::vec::Vec<ClassificationCategory>,
}
/// The request message for the text annotation API, which can perform multiple
/// analysis types (sentiment, entities, and syntax) in one call.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateTextRequest {
/// Required. Input document.
#[prost(message, optional, tag = "1")]
pub document: ::core::option::Option<Document>,
/// Required. The enabled features.
#[prost(message, optional, tag = "2")]
pub features: ::core::option::Option<annotate_text_request::Features>,
/// The encoding type used by the API to calculate offsets.
#[prost(enumeration = "EncodingType", tag = "3")]
pub encoding_type: i32,
}
/// Nested message and enum types in `AnnotateTextRequest`.
pub mod annotate_text_request {
/// All available features for sentiment, syntax, and semantic analysis.
/// Setting each one to true will enable that specific analysis for the input.
/// Next ID: 12
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Features {
/// Extract syntax information.
#[prost(bool, tag = "1")]
pub extract_syntax: bool,
/// Extract entities.
#[prost(bool, tag = "2")]
pub extract_entities: bool,
/// Extract document-level sentiment.
#[prost(bool, tag = "3")]
pub extract_document_sentiment: bool,
/// Extract entities and their associated sentiment.
#[prost(bool, tag = "4")]
pub extract_entity_sentiment: bool,
/// Classify the full document into categories. If this is true,
/// the API will use the default model which classifies into a
/// [predefined
/// taxonomy](<https://cloud.google.com/natural-language/docs/categories>).
#[prost(bool, tag = "6")]
pub classify_text: bool,
/// Moderate the document for harmful and sensitive categories.
#[prost(bool, tag = "11")]
pub moderate_text: bool,
/// The model options to use for classification. Defaults to v1 options
/// if not specified. Only used if `classify_text` is set to true.
#[prost(message, optional, tag = "10")]
pub classification_model_options: ::core::option::Option<
super::ClassificationModelOptions,
>,
}
}
/// The text annotations response message.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnnotateTextResponse {
/// Sentences in the input document. Populated if the user enables
/// [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].
#[prost(message, repeated, tag = "1")]
pub sentences: ::prost::alloc::vec::Vec<Sentence>,
/// Tokens, along with their syntactic information, in the input document.
/// Populated if the user enables
/// [AnnotateTextRequest.Features.extract_syntax][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_syntax].
#[prost(message, repeated, tag = "2")]
pub tokens: ::prost::alloc::vec::Vec<Token>,
/// Entities, along with their semantic information, in the input document.
/// Populated if the user enables
/// [AnnotateTextRequest.Features.extract_entities][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_entities].
#[prost(message, repeated, tag = "3")]
pub entities: ::prost::alloc::vec::Vec<Entity>,
/// The overall sentiment for the document. Populated if the user enables
/// [AnnotateTextRequest.Features.extract_document_sentiment][google.cloud.language.v1beta2.AnnotateTextRequest.Features.extract_document_sentiment].
#[prost(message, optional, tag = "4")]
pub document_sentiment: ::core::option::Option<Sentiment>,
/// The language of the text, which will be the same as the language specified
/// in the request or, if not specified, the automatically-detected language.
/// See [Document.language][google.cloud.language.v1beta2.Document.language]
/// field for more details.
#[prost(string, tag = "5")]
pub language: ::prost::alloc::string::String,
/// Categories identified in the input document.
#[prost(message, repeated, tag = "6")]
pub categories: ::prost::alloc::vec::Vec<ClassificationCategory>,
/// Harmful and sensitive categories identified in the input document.
#[prost(message, repeated, tag = "8")]
pub moderation_categories: ::prost::alloc::vec::Vec<ClassificationCategory>,
}
/// Represents the text encoding that the caller uses to process the output.
/// Providing an `EncodingType` is recommended because the API provides the
/// beginning offsets for various outputs, such as tokens and mentions, and
/// languages that natively use different text encodings may access offsets
/// differently.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum EncodingType {
/// If `EncodingType` is not specified, encoding-dependent information (such as
/// `begin_offset`) will be set at `-1`.
None = 0,
/// Encoding-dependent information (such as `begin_offset`) is calculated based
/// on the UTF-8 encoding of the input. C++ and Go are examples of languages
/// that use this encoding natively.
Utf8 = 1,
/// Encoding-dependent information (such as `begin_offset`) is calculated based
/// on the UTF-16 encoding of the input. Java and JavaScript are examples of
/// languages that use this encoding natively.
Utf16 = 2,
/// Encoding-dependent information (such as `begin_offset`) is calculated based
/// on the UTF-32 encoding of the input. Python is an example of a language
/// that uses this encoding natively.
Utf32 = 3,
}
impl EncodingType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
EncodingType::None => "NONE",
EncodingType::Utf8 => "UTF8",
EncodingType::Utf16 => "UTF16",
EncodingType::Utf32 => "UTF32",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NONE" => Some(Self::None),
"UTF8" => Some(Self::Utf8),
"UTF16" => Some(Self::Utf16),
"UTF32" => Some(Self::Utf32),
_ => None,
}
}
}
/// Generated client implementations.
pub mod language_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// Provides text analysis operations such as sentiment analysis and entity
/// recognition.
#[derive(Debug, Clone)]
pub struct LanguageServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> LanguageServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> LanguageServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
LanguageServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Analyzes the sentiment of the provided text.
pub async fn analyze_sentiment(
&mut self,
request: impl tonic::IntoRequest<super::AnalyzeSentimentRequest>,
) -> std::result::Result<
tonic::Response<super::AnalyzeSentimentResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/AnalyzeSentiment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"AnalyzeSentiment",
),
);
self.inner.unary(req, path, codec).await
}
/// Finds named entities (currently proper names and common nouns) in the text
/// along with entity types, salience, mentions for each entity, and
/// other properties.
pub async fn analyze_entities(
&mut self,
request: impl tonic::IntoRequest<super::AnalyzeEntitiesRequest>,
) -> std::result::Result<
tonic::Response<super::AnalyzeEntitiesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/AnalyzeEntities",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"AnalyzeEntities",
),
);
self.inner.unary(req, path, codec).await
}
/// Finds entities, similar to
/// [AnalyzeEntities][google.cloud.language.v1beta2.LanguageService.AnalyzeEntities]
/// in the text and analyzes sentiment associated with each entity and its
/// mentions.
pub async fn analyze_entity_sentiment(
&mut self,
request: impl tonic::IntoRequest<super::AnalyzeEntitySentimentRequest>,
) -> std::result::Result<
tonic::Response<super::AnalyzeEntitySentimentResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/AnalyzeEntitySentiment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"AnalyzeEntitySentiment",
),
);
self.inner.unary(req, path, codec).await
}
/// Analyzes the syntax of the text and provides sentence boundaries and
/// tokenization along with part of speech tags, dependency trees, and other
/// properties.
pub async fn analyze_syntax(
&mut self,
request: impl tonic::IntoRequest<super::AnalyzeSyntaxRequest>,
) -> std::result::Result<
tonic::Response<super::AnalyzeSyntaxResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/AnalyzeSyntax",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"AnalyzeSyntax",
),
);
self.inner.unary(req, path, codec).await
}
/// Classifies a document into categories.
pub async fn classify_text(
&mut self,
request: impl tonic::IntoRequest<super::ClassifyTextRequest>,
) -> std::result::Result<
tonic::Response<super::ClassifyTextResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/ClassifyText",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"ClassifyText",
),
);
self.inner.unary(req, path, codec).await
}
/// Moderates a document for harmful and sensitive categories.
pub async fn moderate_text(
&mut self,
request: impl tonic::IntoRequest<super::ModerateTextRequest>,
) -> std::result::Result<
tonic::Response<super::ModerateTextResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/ModerateText",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"ModerateText",
),
);
self.inner.unary(req, path, codec).await
}
/// A convenience method that provides all syntax, sentiment, entity, and
/// classification features in one call.
pub async fn annotate_text(
&mut self,
request: impl tonic::IntoRequest<super::AnnotateTextRequest>,
) -> std::result::Result<
tonic::Response<super::AnnotateTextResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.language.v1beta2.LanguageService/AnnotateText",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.language.v1beta2.LanguageService",
"AnnotateText",
),
);
self.inner.unary(req, path, codec).await
}
}
}