-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
6,548 additions
and
2,078 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { spellCheckByDAUM } from 'hanspell'; | ||
|
||
export default async function handler(req, res) { | ||
let data = []; | ||
const check = function (json) { | ||
data = data.concat(json); | ||
}; | ||
const end = function () { | ||
res.json(data); | ||
}; | ||
const error = function (err) { | ||
console.error('// error: ' + err); | ||
}; | ||
|
||
spellCheckByDAUM(req.body.text, 6000, check, end, error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { spellCheckByPNU } from 'hanspell'; | ||
|
||
export default async function handler(req, res) { | ||
let data = []; | ||
const check = function (json) { | ||
data = data.concat(json); | ||
}; | ||
const end = function () { | ||
res.json(data); | ||
}; | ||
const error = function (err) { | ||
console.error('// error: ' + err); | ||
}; | ||
|
||
spellCheckByPNU(req.body.text, 6000, check, end, error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,70 @@ | ||
import type { NextPage } from 'next'; | ||
import axios from 'axios'; | ||
import { useState } from 'react'; | ||
import JSONPretty from 'react-json-pretty'; | ||
|
||
const HomePage: NextPage = () => { | ||
return <>바로</>; | ||
const HomePage = () => { | ||
const [text, setText] = useState(''); | ||
const [result, setResult] = useState(null); | ||
const [result2, setResult2] = useState(null); | ||
|
||
const checkSpelling = async () => { | ||
try { | ||
const response = await axios.post('/api/spellingCheck', { text }); | ||
setResult(response.data); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
const checkSpelling2 = async () => { | ||
try { | ||
const response2 = await axios.post('/api/spellingCheck2', { text }); | ||
setResult2(response2.data); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
return ( | ||
<div style={{ padding: '30px' }}> | ||
<input | ||
style={{ border: '1px solid black', width: '500px', padding: '5px' }} | ||
type="text" | ||
value={text} | ||
onChange={(e) => setText(e.target.value)} | ||
/> | ||
<button | ||
onClick={() => { | ||
checkSpelling(); | ||
checkSpelling2(); | ||
}} | ||
> | ||
Check | ||
</button> | ||
|
||
{result && ( | ||
<div style={{ marginTop: '20px' }}> | ||
<h3>맞춤법 검사 결과(DAUM):</h3> | ||
<JSONPretty | ||
style={{ marginTop: '10px' }} | ||
id="json-pretty" | ||
data={result} | ||
></JSONPretty> | ||
</div> | ||
)} | ||
|
||
{result2 && ( | ||
<div style={{ marginTop: '20px' }}> | ||
<h3>맞춤법 검사 결과(부산대):</h3> | ||
<JSONPretty | ||
style={{ marginTop: '10px' }} | ||
id="json-pretty" | ||
data={result2} | ||
></JSONPretty> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default HomePage; |
Oops, something went wrong.