gpt4 book ai didi

linux - 从 .seg 文件中提取数据

转载 作者:太空宇宙 更新时间:2023-11-04 09:17:17 26 4
gpt4 key购买 nike

我有一个 .seg 文件,其中包含音频文件二值化后形成的簇数据。该文件具有以下数据:

;; cluster S0 [ score:FS = -32.694324625945725 ] [ score:FT = 
-33.32942628147711 ] [ score:MS = -32.847416329096404 ] [ score:MT =
-33.45196981196905 ]
ElonN 1 0 758 F S U S0
;; cluster S1 [ score:FS = -33.14490351155562 ] [ score:FT =
-33.420111126893076 ] [ score:MS = -32.29039025858266 ] [ score:MT =
-32.85038927851203 ]
ElonN 1 758 308 M S U S1
ElonN 1 1110 700 M S U S1
ElonN 1 1887 2794 M S U S1
ElonN 1 4849 1190 M S U S1
;; cluster S10 [ score:FS = -34.466969784129404 ] [ score:FT =
-34.951981832991414 ] [ score:MS = -34.83408030011385 ] [ score:MT =
-35.17326803680231 ]
ElonN 1 6731 352 F S U S10
;; cluster S11 [ score:FS = -33.57333115273301 ] [ score:FT =
-33.93961876513661 ] [ score:MS = -32.6529742867516 ] [ score:MT =
-33.397218081762475 ]
ElonN 1 7459 2542 M S U S11
;; cluster S16 [ score:FS = -33.29482735979043 ] [ score:FT =
-33.687616298740195 ] [ score:MS = -32.189984103971135 ] [ score:MT =
-33.13899965310298 ]
ElonN 1 10001 3051 M S U S16
ElonN 1 13086 912 M S U S16
;; cluster S9 [ score:FS = -33.4457701986847 ] [ score:FT =
-34.70059869569136 ] [ score:MS = -33.958162156208914 ] [ score:MT =
-34.79598011488008 ]
ElonN 1 6039 692 F S U S9

我必须提取开始时间(第 3 列)、演讲持续时间(第 4 列)和最后一列(演讲者姓名)。

在下面的片段中

ElonN 1 6039 692 F S U S9

6039 是段的开始时间。692是段的持续时间。S9 是演讲者姓名。

我编写的以下 shell 脚本提取了整个段并存储在文件中。

echo "Enter audio file name. (File must be of .wav format)"

read fileName

echo "Enter path of the audio file"

read path

echo "Enter folder name"

read outputfolder

mkdir -p $outputfolder

echo "Processing $fileName"
./ilp_diarization2.sh $path/$fileName.wav 120 $outputfolder


grep "$fileName.*S" $outputfolder/$fileName/$fileName.g.3.seg > a


cat a

最佳答案

您可以使用 wak 等:

var=$(awk '{ print $3" "$4" "$NF }' filename)

awk '{ print $3" "$4" "$NF }' filename > outputfile

$number 指的是您关心的以空格分隔(awk 的默认值)的数据。

关于linux - 从 .seg 文件中提取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45793177/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com