Skip to content

Commit

Permalink
feat: 메뉴 명을 번역하는 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hong-sile committed Feb 20, 2024
1 parent b1a5e40 commit 4cf860f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public List<ReconfigureResponse> reconfigure(final ReconfigureRequest request) {
final List<MenuItem> menuItems = ocrReader.read(request.base64EncodedImage());
log.info("ocr 끝");
//음식 정보 크롤링 : 조회 후 설명 번역
final List<FoodInfo> foodInfos = createFoodInfos(menuItems, userLanguage);
final List<FoodInfo> foodInfos = createFoodInfos(menuItems, userLanguage, originLanguage);
//환율 계산
final List<PriceInfo> convertedPrices = convertCurrency(
menuItems, originCurrency, userCurrency
Expand Down Expand Up @@ -92,11 +92,12 @@ private List<PriceInfo> convertCurrency(
}

private List<FoodInfo> createFoodInfos(
final List<MenuItem> menuItems, final Language userLanguage
final List<MenuItem> menuItems, final Language userLanguage, final Language originLanguage
) {
log.info("이미지 크롤링 시작");
final List<String> menuItemNames = menuItems.stream()
.map(MenuItem::name)
.map(name -> translationClient.translate(originLanguage, Language.ENGLISH, name))
.toList();
final List<FoodInfo> result = foodScraper.scrape(menuItemNames).stream()
.map(foodInfo -> new FoodInfo(
Expand Down

0 comments on commit 4cf860f

Please sign in to comment.