장기현장실습
SNU 성문분석 이슈
#50 N:N 분석(시각화) 기능 추가 이슈 진행중
- N:N 분석의 유사도 결과 테이블 생성중
- 사용자가 선택한 음성 파일 명을 나타내고, 유사도를 보여주는 코드를 작성하고 있는 중이다. 첫번째로 선택한 음성파일들과 두번째로 선택한 음성파일들의 곱 만큼 결과가 생성되기 때문에 중복을 없애고 파일명을 나타내도록 했다.
// SimilarManyVoicesTable.tsx export default function SimilarManyVoicesTable({ className, manyToManyResult } : Props): JSX.Element { const tableHead = useMemo(() => { let voice = [...manyToManyResult]; const temp = new Array(); voice.map(r => temp.push(r.voice_1st.name)); let voice_1st = temp.filter((item, idx, self) => { return self.indexOf(item) === idx; }) voice_1st = voice_1st.length > 10 ? voice_1st.slice(0, 10) : voice_1st; return voice_1st.map(name => ( <> <th className="col">{ name }</th> </> )) }, [ manyToManyResult ]); const tableRows = useMemo(() => { let voice = [...manyToManyResult]; const temp = new Array(); voice.map(r => temp.push(r.voice_2nd.name)); let voice_2nd = temp.filter((item, idx, self) => { return self.indexOf(item) === idx; }) voice_2nd = voice_2nd.length > 10 ? voice_2nd.slice(0, 10) : voice_2nd; return voice_2nd.map(name => ( <tr className="row m-0"> <th className="col m-0">{ name }</th> </tr> )); }, [ manyToManyResult ]); ...
- 사용자가 선택한 음성 파일 명을 나타내고, 유사도를 보여주는 코드를 작성하고 있는 중이다. 첫번째로 선택한 음성파일들과 두번째로 선택한 음성파일들의 곱 만큼 결과가 생성되기 때문에 중복을 없애고 파일명을 나타내도록 했다.
'TIL' 카테고리의 다른 글
# 211221 TIL ([React, tsx] 부트스트랩 UI 수정) (0) | 2021.12.22 |
---|---|
# 211220 TIL ([React, tsx] 체크박스 클릭 시 함수 실행) (0) | 2021.12.20 |
# 211209 TIL ([Ruby, slim] 함수 매개변수 사용하여 쿼리하기) (0) | 2021.12.10 |
# 211208 TIL ([React, tsx] type 마다 컴포넌트 내용 변경하기) (0) | 2021.12.10 |
# 211207 TIL ([Ruby, slim] link_to URL 연결하기, DB 데이터 쿼리 / [React, tsx] useState로 값 설정하기, type 마다 다른 UI 나오도록 수정) (0) | 2021.12.08 |