From b1c186fd00fef54bcad3aa1d073a1a313642d641 Mon Sep 17 00:00:00 2001
From: zhifu gao <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 08 五月 2024 00:31:29 +0800
Subject: [PATCH] Dev gzf exp (#1700)
---
funasr/utils/misc.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/funasr/utils/misc.py b/funasr/utils/misc.py
index 5eaa4f8..9f01955 100644
--- a/funasr/utils/misc.py
+++ b/funasr/utils/misc.py
@@ -78,3 +78,17 @@
# config_json = os.path.join(model_path, "configuration.json")
# if os.path.exists(config_json):
# shutil.copy(config_json, os.path.join(kwargs.get("output_dir", "./"), "configuration.json"))
+
+
+def extract_filename_without_extension(file_path):
+ """
+ 浠庣粰瀹氱殑鏂囦欢璺緞涓彁鍙栨枃浠跺悕锛堜笉鍖呭惈璺緞鍜屾墿灞曞悕锛�
+ :param file_path: 瀹屾暣鐨勬枃浠惰矾寰�
+ :return: 鏂囦欢鍚嶏紙涓嶅惈璺緞鍜屾墿灞曞悕锛�
+ """
+ # 棣栧厛锛屼娇鐢╫s.path.basename鑾峰彇璺緞涓殑鏂囦欢鍚嶉儴鍒嗭紙鍚墿灞曞悕锛�
+ filename_with_extension = os.path.basename(file_path)
+ # 鐒跺悗锛屼娇鐢╫s.path.splitext鍒嗙鏂囦欢鍚嶅拰鎵╁睍鍚�
+ filename, extension = os.path.splitext(filename_with_extension)
+ # 杩斿洖涓嶅寘鍚墿灞曞悕鐨勬枃浠跺悕
+ return filename
--
Gitblit v1.9.1