only_ever_generator 0.3.4 → 0.3.5
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/dist/bootstrap/app.js +2 -1
- package/dist/constants/source_data.js +937 -530
- package/dist/gap_fill/calculate_gap_fill.js +2 -2
- package/dist/index.js +1 -1
- package/dist/parse/parse_source_content.js +6 -10
- package/package.json +1 -1
- package/src/bootstrap/app.ts +1 -1
- package/src/constants/source_data.ts +937 -530
- package/src/gap_fill/calculate_gap_fill.ts +1 -1
- package/src/index.ts +1 -1
- package/src/parse/parse_source_content.ts +10 -15
|
@@ -20,7 +20,7 @@ export function gapFilling(typologyResponse: any, cardgenResponse : any) {
|
|
|
20
20
|
allFacts.push(...(cardgenResponse.missing_facts ?? []));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if(cardgenResponse.cards_data !== undefined && cardgenResponse.cards_data
|
|
23
|
+
if(cardgenResponse.cards_data !== undefined && cardgenResponse.cards_data?.length != 0) {
|
|
24
24
|
for (let card of cardgenResponse.cards_data) {
|
|
25
25
|
if (card.concepts.length != 0) {
|
|
26
26
|
generatedConceptsList.push(...card.concepts);
|
package/src/index.ts
CHANGED
|
@@ -51,7 +51,7 @@ import { OnlyEverGenerator } from "./bootstrap/app";
|
|
|
51
51
|
// // summary_prompt: "",
|
|
52
52
|
// // }
|
|
53
53
|
// // )
|
|
54
|
-
// let typologyRequest = await oeGen.generate(
|
|
54
|
+
// let typologyRequest = await oeGen.generate(true, true);
|
|
55
55
|
// res.send(typologyRequest);
|
|
56
56
|
// }
|
|
57
57
|
// });
|
|
@@ -2,7 +2,7 @@ export class ParseSourceContent{
|
|
|
2
2
|
public content: any;
|
|
3
3
|
|
|
4
4
|
titles_to_remove = ['See also', 'References', 'Further reading', 'External links', 'Notes and references', 'Bibliography', 'Notes', 'Cited sources'];
|
|
5
|
-
|
|
5
|
+
block_types_toremove = ['table','empty_line'];
|
|
6
6
|
constructor(sourceContent:any){
|
|
7
7
|
this.content = sourceContent;
|
|
8
8
|
}
|
|
@@ -17,18 +17,7 @@ export class ParseSourceContent{
|
|
|
17
17
|
content: afterSanitized,
|
|
18
18
|
headings: this.content.headings,
|
|
19
19
|
taxonomy: this.content.taxonomy,
|
|
20
|
-
}
|
|
21
|
-
// } else if(this.content.type == 'cards'){
|
|
22
|
-
// return {
|
|
23
|
-
// type :'card',
|
|
24
|
-
// title: this.content.title,
|
|
25
|
-
// content: afterSanitized,
|
|
26
|
-
// headings: this.content.headings
|
|
27
|
-
// taxonomy: this.content.taxonomy,
|
|
28
|
-
// };
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
// return JSON.stringify(afterSanitized);
|
|
20
|
+
}
|
|
32
21
|
}
|
|
33
22
|
|
|
34
23
|
removeSectionsByTitle(data: Array<any>){
|
|
@@ -37,8 +26,13 @@ export class ParseSourceContent{
|
|
|
37
26
|
if(elem.block_type == 'heading' && this.titles_to_remove.includes(elem.content)){
|
|
38
27
|
continue;
|
|
39
28
|
}
|
|
29
|
+
/// remove unwanted blcok types , for now `table` and `empty_line`
|
|
30
|
+
if(this.block_types_toremove.includes(elem.block_type)){
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
40
33
|
if(elem.children){
|
|
41
34
|
elem.children = this.removeSectionsByTitle(elem.children)
|
|
35
|
+
|
|
42
36
|
}
|
|
43
37
|
dataAfterRemoving.push(elem)
|
|
44
38
|
|
|
@@ -46,8 +40,7 @@ export class ParseSourceContent{
|
|
|
46
40
|
return dataAfterRemoving;
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
sanitizeWikiContent(content: String) {
|
|
43
|
+
sanitizeWikiContent(content: String) {
|
|
51
44
|
// Remove newline characters
|
|
52
45
|
content = content.replace(/\\n/g, ' ');
|
|
53
46
|
|
|
@@ -68,7 +61,9 @@ export class ParseSourceContent{
|
|
|
68
61
|
|
|
69
62
|
sanitizeBlocks(blocks: Array<any>) {
|
|
70
63
|
let sanitizedBlocks = <any>[] ;
|
|
64
|
+
blocks = blocks.filter((item)=> item.block_type != 'table');
|
|
71
65
|
blocks.forEach(block => {
|
|
66
|
+
|
|
72
67
|
let sanitizedBlock: any = {};
|
|
73
68
|
for (let key in block) {
|
|
74
69
|
let value = block[key];
|