Whenever you have a sword, remember these tips could save your life.
*Never wield your sword out in the open. I mean never. Switch to your other weapon, an SMG or a battle rifle in this case. Chances are, if you are spotted by an enemy, he or she won't think that you have a sword, because if you did, you'd have it out and try to slice him or her right now, right? Wrong. If you wait for the right moment, quickly switch to the sword and press the trigger immediately after. Then switch back to the other weapon. It will eventually become a second nature, and you will kill anybody brave enough to come close to you.
*Do not always try to lunge. Remember that a melee has a slightly faster recovery time, so when you're that close with your enemy, it is not a necessity to lunge. A quick melee with the sword by pressing B is just as potent.