wiki-entity 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/lib/index.js +129 -146
- package/lib/request.js +37 -19
- package/lib/simpleEntity/convertToSimpleEntity.js +53 -53
- package/lib/simpleEntity/getEntityCountry.js +25 -25
- package/lib/simpleEntity/getEntityData.js +27 -27
- package/lib/simpleEntity/getEntityInstanceType.js +32 -32
- package/lib/simpleEntity/getEntityType.js +62 -62
- package/lib/simpleEntity/getEntityTypeByExtract.js +28 -28
- package/lib/simpleEntity/index.js +7 -7
- package/lib/simpleEntity/simpleEntity.js +20 -20
- package/lib/types.js +13 -13
- package/lib/utils.js +15 -15
- package/lib/wikidata/api.js +106 -106
- package/lib/wikidata/get_entity_types.js +60 -60
- package/lib/wikidata/index.js +112 -112
- package/lib/wikidata/simplify_claims.js +100 -100
- package/lib/wikidata/simplify_entity.js +76 -76
- package/lib/wikipedia/api.js +146 -146
- package/package.json +1 -1
- package/types/index.d.ts +9 -8
- package/types/request.d.ts +5 -3
- package/types/simpleEntity/convertToSimpleEntity.d.ts +6 -6
- package/types/simpleEntity/getEntityCountry.d.ts +2 -2
- package/types/simpleEntity/getEntityData.d.ts +3 -3
- package/types/simpleEntity/getEntityInstanceType.d.ts +3 -3
- package/types/simpleEntity/getEntityType.d.ts +3 -3
- package/types/simpleEntity/getEntityTypeByExtract.d.ts +2 -2
- package/types/simpleEntity/index.d.ts +2 -2
- package/types/simpleEntity/simpleEntity.d.ts +29 -29
- package/types/types.d.ts +68 -68
- package/types/utils.d.ts +8 -8
- package/types/wikidata/api.d.ts +4 -4
- package/types/wikidata/get_entity_types.d.ts +1 -1
- package/types/wikidata/index.d.ts +3 -3
- package/types/wikidata/simplify_claims.d.ts +4 -4
- package/types/wikidata/simplify_entity.d.ts +21 -21
- package/types/wikipedia/api.d.ts +31 -31
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { WikidataEntity } from "../types";
|
|
2
|
-
export declare type SimplifyEntityOptionsType = {
|
|
3
|
-
labels?: boolean;
|
|
4
|
-
descriptions?: boolean;
|
|
5
|
-
aliases?: boolean;
|
|
6
|
-
sitelinks?: boolean;
|
|
7
|
-
claims?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare function simplifyEntity(lang: string, data: any, options?: SimplifyEntityOptionsType): WikidataEntity;
|
|
10
|
-
export declare function simplifyAliases(data: any): {
|
|
11
|
-
[index: string]: string[];
|
|
12
|
-
};
|
|
13
|
-
export declare function simplifyDescriptions(data: any): {
|
|
14
|
-
[index: string]: string;
|
|
15
|
-
};
|
|
16
|
-
export declare function simplifyLabels(data: any): {
|
|
17
|
-
[index: string]: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function simplifySitelinks(data: any): {
|
|
20
|
-
[index: string]: string;
|
|
21
|
-
};
|
|
1
|
+
import { WikidataEntity } from "../types";
|
|
2
|
+
export declare type SimplifyEntityOptionsType = {
|
|
3
|
+
labels?: boolean;
|
|
4
|
+
descriptions?: boolean;
|
|
5
|
+
aliases?: boolean;
|
|
6
|
+
sitelinks?: boolean;
|
|
7
|
+
claims?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function simplifyEntity(lang: string, data: any, options?: SimplifyEntityOptionsType): WikidataEntity;
|
|
10
|
+
export declare function simplifyAliases(data: any): {
|
|
11
|
+
[index: string]: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function simplifyDescriptions(data: any): {
|
|
14
|
+
[index: string]: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function simplifyLabels(data: any): {
|
|
17
|
+
[index: string]: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function simplifySitelinks(data: any): {
|
|
20
|
+
[index: string]: string;
|
|
21
|
+
};
|
package/types/wikipedia/api.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { StringPlainObject } from "../utils";
|
|
2
|
-
export declare type ExtractType = {
|
|
3
|
-
pageid: number;
|
|
4
|
-
title: string;
|
|
5
|
-
extract: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type ExtractsParamsType = {
|
|
8
|
-
lang: string;
|
|
9
|
-
titles: string[];
|
|
10
|
-
sentences?: number;
|
|
11
|
-
};
|
|
12
|
-
export declare type ApiResult = {
|
|
13
|
-
pageid: number;
|
|
14
|
-
title: string;
|
|
15
|
-
extract?: string;
|
|
16
|
-
categories?: string[];
|
|
17
|
-
redirects?: string[];
|
|
18
|
-
};
|
|
19
|
-
export declare class Api {
|
|
20
|
-
private qs;
|
|
21
|
-
private httpTimeout?;
|
|
22
|
-
constructor(qs?: StringPlainObject, httpTimeout?: number);
|
|
23
|
-
query(lang: string, qs?: StringPlainObject): Promise<ApiResult[]>;
|
|
24
|
-
redirects(): this;
|
|
25
|
-
categories(): this;
|
|
26
|
-
extract(sentences?: number): this;
|
|
27
|
-
private addField;
|
|
28
|
-
}
|
|
29
|
-
export declare function getExtracts(params: ExtractsParamsType): Promise<ExtractType[]>;
|
|
30
|
-
export declare const getExtract: (lang: string, title: string, sentences?: number) => Promise<ExtractType | null>;
|
|
31
|
-
export declare function getRedirects(lang: string, title: string): Promise<string[]>;
|
|
1
|
+
import { StringPlainObject } from "../utils";
|
|
2
|
+
export declare type ExtractType = {
|
|
3
|
+
pageid: number;
|
|
4
|
+
title: string;
|
|
5
|
+
extract: string;
|
|
6
|
+
};
|
|
7
|
+
export declare type ExtractsParamsType = {
|
|
8
|
+
lang: string;
|
|
9
|
+
titles: string[];
|
|
10
|
+
sentences?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare type ApiResult = {
|
|
13
|
+
pageid: number;
|
|
14
|
+
title: string;
|
|
15
|
+
extract?: string;
|
|
16
|
+
categories?: string[];
|
|
17
|
+
redirects?: string[];
|
|
18
|
+
};
|
|
19
|
+
export declare class Api {
|
|
20
|
+
private qs;
|
|
21
|
+
private httpTimeout?;
|
|
22
|
+
constructor(qs?: StringPlainObject, httpTimeout?: number);
|
|
23
|
+
query(lang: string, qs?: StringPlainObject): Promise<ApiResult[]>;
|
|
24
|
+
redirects(): this;
|
|
25
|
+
categories(): this;
|
|
26
|
+
extract(sentences?: number): this;
|
|
27
|
+
private addField;
|
|
28
|
+
}
|
|
29
|
+
export declare function getExtracts(params: ExtractsParamsType): Promise<ExtractType[]>;
|
|
30
|
+
export declare const getExtract: (lang: string, title: string, sentences?: number) => Promise<ExtractType | null>;
|
|
31
|
+
export declare function getRedirects(lang: string, title: string): Promise<string[]>;
|