Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit b77505d

Browse files
vishwacsenaVishwac Sena Kannan
andauthored
fix source .vs. ID order in JSON -> QnA format (#710)
* fix source .vs. ID order in JSON -> QnA format * fixing tests Co-authored-by: Vishwac Sena Kannan <[email protected]>
1 parent 873f6c8 commit b77505d

File tree

8 files changed

+29
-27
lines changed

8 files changed

+29
-27
lines changed

packages/lu/src/parser/qna/qnamaker/qnaConverter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const qnaToLuContent = function(qnaJSON){
2727
}
2828

2929
root.forEach(function(qnaItem) {
30-
fileContent += qnaItem.id.toString() !== "0" ? `<a id = "${qnaItem.id}"></a>` + NEWLINE + NEWLINE : '';
3130
fileContent += '> !# @qna.pair.source = ' + qnaItem.source + NEWLINE + NEWLINE;
31+
fileContent += qnaItem.id.toString() !== "0" ? `<a id = "${qnaItem.id}"></a>` + NEWLINE + NEWLINE : '';
3232
fileContent += '## ? ' + qnaItem.questions[0] + NEWLINE;
3333
qnaItem.questions.splice(0,1);
3434
qnaItem.questions.forEach(function(question) {

packages/lu/test/fixtures/testcases/qnaref.qna

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> !# @qna.source=hand added
1+
> !# @qna.pair.source=hand added
22
# ?hello
33
- [another](./collate/1.lu#Greeting)
44
**Filters:**

packages/lu/test/fixtures/verified/allGenQnA.lu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
> !# @qna.pair.source = custom editorial
44

5+
<a id = "181"></a>
6+
57
## ? How do I change the default message
68

79
```markdown

packages/luis/test/fixtures/testcases/qnaref.qna

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> !# @qna.source=hand added
1+
> !# @qna.pair.source=hand added
22
# ?hello
33
- [another](./collate/1.lu#Greeting)
44
**Filters:**

packages/qnamaker/test/fixtures/testcases/qnaref.qna

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> !# @qna.source=hand added
1+
> !# @qna.pair.source=hand added
22
# ?hello
33
- [another](./collate/1.lu#Greeting)
44
**Filters:**

packages/qnamaker/test/fixtures/verified/MultiturnReplaceKbWithFlattenedTree.qna

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
> # QnA pairs
22

3-
<a id = "1"></a>
4-
53
> !# @qna.pair.source = Editorial
64

5+
<a id = "1"></a>
6+
77
## ? ques1
88

99
```markdown
@@ -15,40 +15,40 @@ ans1
1515
- [p2](#3) `context-only`
1616
- [p3](#4)
1717

18-
<a id = "2"></a>
19-
2018
> !# @qna.pair.source = Editorial
2119

20+
<a id = "2"></a>
21+
2222
## ? p1
2323

2424
```markdown
2525
ap1
2626
```
2727

28-
<a id = "3"></a>
29-
3028
> !# @qna.pair.source = Editorial
3129

30+
<a id = "3"></a>
31+
3232
## ? p2
3333

3434
```markdown
3535
ap2
3636
```
3737

38-
<a id = "4"></a>
39-
4038
> !# @qna.pair.source = Editorial
4139

40+
<a id = "4"></a>
41+
4242
## ? p3
4343

4444
```markdown
4545
ap3
4646
```
4747

48-
<a id = "5"></a>
49-
5048
> !# @qna.pair.source = Editorial
5149

50+
<a id = "5"></a>
51+
5252
## ? qew
5353

5454
```markdown

packages/qnamaker/test/fixtures/verified/multiturn.json.qna

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
> # QnA pairs
22

3-
<a id = "1"></a>
4-
53
> !# @qna.pair.source = xyz
64

5+
<a id = "1"></a>
6+
77
## ? hello
88

99
**Filters:**
@@ -18,51 +18,51 @@ hi there
1818
- [flight booking](#32) `context-only`
1919
- [weather](#2) `context-only`
2020

21-
<a id = "2"></a>
22-
2321
> !# @qna.pair.source = custom editorial
2422

23+
<a id = "2"></a>
24+
2525
## ? weather
2626

2727
```markdown
2828
sure will get weather
2929
```
3030

31-
<a id = "3"></a>
32-
3331
> !# @qna.pair.source = custom editorial
3432

33+
<a id = "3"></a>
34+
3535
## ? q2
3636
- tell me a joke
3737

3838
```markdown
3939
ha ha ha
4040
```
4141

42-
<a id = "32"></a>
43-
4442
> !# @qna.pair.source = custom editorial
4543

44+
<a id = "32"></a>
45+
4646
## ? book flight
4747

4848
```markdown
4949
sure. happy to help with that.
5050
```
5151

52-
<a id = "4"></a>
53-
5452
> !# @qna.pair.source = custom editorial
5553

54+
<a id = "4"></a>
55+
5656
## ? batata
5757

5858
```markdown
5959
tomato
6060
```
6161

62-
<a id = "5"></a>
63-
6462
> !# @qna.pair.source = custom editorial
6563

64+
<a id = "5"></a>
65+
6666
## ? testquestion
6767

6868
```markdown

packages/qnamaker/test/fixtures/verified/qna5.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"id": 0,
66
"answer": "hi there",
7-
"source": "custom editorial",
7+
"source": "hand added",
88
"questions": [
99
"hello",
1010
"Hi",

0 commit comments

Comments
 (0)