两个数组共同出现的最高频率词汇

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <section id="part1">
            Effective Friday, Screen Actors Guild-American Federation of Television and Radio Artists ( SAG-AFTRA) has declared a strike against 11 video game publishers over games that went into production after Feb.17, 2015. The companies include some of the heavyweights of the industry, like Electronic Arts Productions, Insomniac Games, Activision and Disney.

            The strike comes in light of an unsuccessful 19 months of negotiations after the existing labor contract known as the Interactive Media Agreement expired in late 2014. Overall, the strike is an effort to provide more secondary compensation along with other concerns, such as transparency upon hiring talent and on-set (制作中) safety precautions.
            
            The video gaming industry has ballooned in recent years. The Los Angeles Times reports that the industry is in the midst of an intense increase in cash flow. In 2015, gaming produced $ 23.5 billion in domestic revenue.
            
            But SAG-AFTRA says voice actors don't receive residuals (追加酬金) for their gaming work. Instead, they receive a fixed rate, which is typically about $ 825 for a standard four-hour vocal session. So the voice actors are pushing for the idea of secondary compensation- -a performance bonus every time a game sells 2 million copies or downloads, or reaches 2 million subscribers, with a cap at 8 million.
            
            "It's a very small number of games that would trigger this secondary compensation issue," said voice actor Crispin Freeman, who's a member of the union's negotiating committee. "This is an important aspect of what it means to be a freelance (从事自由职业的) performer , who isn't regularly employed every single day working on projects."
            
            Another major complaint from the actors is the secrecy of the industry. " I can't imagine if there's any other acting job in the world where you don't know what show you're in, when you're hired," says voice actor Keythe Farley, who chairs the SAG-AFTRA negotiating committee.
            
            "And yet that happens every day in the video game world," Farley told reporters during a press conference Friday. "I was a main character in Fallout 4, a character by the name of Kellogg, and I never knew that I was doing vocal recording for that game throughout the year and a half.
            
            Scott Witlin, the lawyer representing the video game companies, says voice actors "represent less than one tenth of 1 percent of the work that goes into making a video game." So "even though they're the top craftsmen in their field," Witlin says, "if we pay them under a vastly different system than the people who do the 99.9 percent of the work, that's going to create far more problems for the video game companies."
        </section>
        
        <section id="part2" style="margin-top: 20px;">
            When I re-entered the full-time workforce a few years ago after a decade of solitary self-employment, there was one thing I was looking forward to the most: the opportunity to have work friends once again. It wasn't until I entered the corporate world that I realized, for me at least, being friends with colleagues didn't emerge as a priority at all. This is surprising when you consider the prevailing emphasis by scholars and trainers and managers on the importance of cultivating close interpersonal relationships at work. So much research has explored the way in which collegial (同事的)ties can help overcome a range of workplace issues affecting productivity and the quality of work output such as team-based conflict, jealousy, undermining, anger, and more.

            Perhaps my expectations of lunches, water-cooler gossip and caring, deep-and-meaningful conversations were a legacy of the last time I was in that kind of office environment. Whereas now, as I near the end of my fourth decade, I realize work can be fully functional and entirely fulfilling without needing to be best mates with the people sitting next to you.
            
            In an academic analysis just published in the profoundly-respected Journal of Management, researchers have looked at the concept of "indifferent relationships". It's a simple term that encapsulates (概括) the fact that relationships at work can reasonably be non-intimate, inconsequential, unimportant and even, dare I say it, disposable or substitutable.
            
            Indifferent relationships are neither positive nor negative. The limited research conducted thus far indicates they're especially dominant among those who value independence over cooperation, and harmony over confrontation. Indifference is also the preferred option among those who are socially lazy. Maintaining relationships over the long term takes effort. For some of us, too much effort .
            
            As noted above, indifferent relationships may not always be the most helpful approach in resolving some of the issues that pop up at work. But there are nonetheless several empirically proven benefits. One of those is efficiency. Less time chatting and socializing means more time working and(产出).
            
            The other is self-esteem. As human beings, we're primed to compare ourselves to each other in what is an anxiety-inducing phenomenon. Apparently, we look down on acquaintances more so than Mends. Since the former is most common among those inclined towards indifferent relationships, their predominance can bolster individuals' sense of self-worth.
            
            Ego aside, a third advantage is that the emotional neutrality of indifferent relationships has been found to enhance critical evaluation, to strengthen one's focus on task resolution, and to gain greater access to valuable information. None of that might be as fun as after-work socializing but, hey, I'll take it anyway.
        </section>
    </body>
    
    
    <script type="text/javascript">
        //获取第一段英文段落
        const document1 = document.querySelector("#part1").innerHTML
        //获取第二段英文段落
        const document2 = document.querySelector("#part2").innerHTML
        
        //获取第一段英文段落中的单词
        const wordArr1 = document1.match(/[a-z\-']+/ig)
        //获取第二段英文段落中的单词
        const wordArr2 = document2.match(/[a-z\-']+/ig)
        
        //去除重复单词
        const wordObj1 = removeRepeat(wordArr1)
        const wordObj2 = removeRepeat(wordArr2)
        
        //获取相同单词,按出现次数从高到底排列
        const sameWordArr = getSameWord(wordObj1,wordObj2)
        //过滤词汇
        const filterWordList = ['the','of','a']
        
        //过滤词汇后出现最高频率的单词
        const top3Rank = getTopRank(sameWordArr,3,filterWordList)
        
        console.log("top three word:", top3Rank[0].word, top3Rank[1].word, top3Rank[2].word)
        console.log("top three word number:", top3Rank[0].num, top3Rank[1].num, top3Rank[2].num)
        
        
        function getTopRank(arr,num,filter){
            num = num?num:arr.length
            let newArr = Object.assign([],arr)
            if(filter&&filter.length){
                for(let i=0;i<filter.length;i++){
                    for(let j=0;j<newArr.length;j++){
                        if(filter[i] == newArr[j].word){
                            newArr.splice(j,1)
                            j--
                            break
                        }
                    }
                }
                return newArr.slice(0,num)
            }else{
                return newArr.slice(0,num)
            }
        }
        
        function getSameWord(wordObj1,wordObj2){
            let sameWordArr = []
            for(let i = 0; i < wordObj1.length; i++) {
                for(let j = 0; j < wordObj2.length; j++) {
                    if(wordObj1[i].word == wordObj2[j].word) {
                        let sameNum = 0
                        if(wordObj1[i].num >= wordObj2[j].num) {
                            sameNum = wordObj2[j].num
                        } else {
                            sameNum = wordObj1[i].num
                        }
                        let newItem = {
                            word: wordObj1[i].word,
                            num: sameNum
                        }
                        if(sameWordArr.length == 0) {
                            sameWordArr.push(newItem)
                        } else {
                            let insert = false
                            for(let k = 0; k < sameWordArr.length; k++) {
                                if(sameNum > sameWordArr[k].num) {
                                    sameWordArr.splice(k, 0, newItem)
                                    insert = true
                                    break
                                }else if(sameNum == sameWordArr[k].num){
                                    sameWordArr.splice(k + 1, 0, newItem)
                                    insert = true
                                    break
                                }
                            }
        
                            if(!insert) {
                                sameWordArr.push(newItem)
                            }
                        }
                        break
                    }
                }
            }
            return sameWordArr
        }
    
        function removeRepeat(wordArr) {
            let wordObj = []
            for(let i = 0; i < wordArr.length; i++) {
                let repeat = false
                if(wordObj.length == 0) {
                    let newItem = {
                        word: wordArr[0],
                        num: 1
                    }
                    wordObj.push(newItem)
                } else {
                    for(let j = 0; j < wordObj.length; j++) {
                        if(wordObj[j].word == wordArr[i]) {
                            repeat = true
                            wordObj[j].num += 1
                            break
                        }
                    }
    
                    if(!repeat) {
                        let newItem = {
                            word: wordArr[i],
                            num: 1
                        }
                        wordObj[wordObj.length] = newItem
                    }
                }
            }
            return wordObj
        }
        
    </script>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值